原创 sklearn 中的 r2_score

R2R^2R2不止一種定義方式,這裏是scikit-learn中所使用的定義。 As such variance is dataset dependent, R² may not be meaningfully comparabl

原创 R語言將所有列數據正交化/縮放

官方例子如下, rescale01 <- function(x) { rng <- range(x, na.rm = TRUE) (x - rng[1]) / (rng[2] - rng[1]) } df <- tibbl

原创 MacBook 風扇控制軟件 Macs Fan Control

明明沒有在跑大程序,蘋果的風扇還是狂轉不停。看來傳感器不是特別靈敏。找到一個可以手動調節的軟件,可以保持中等轉速。 https://crystalidea.com/macs-fan-control/download 世界瞬間清淨。

原创 R語言semi_join()和anti_join()

Filtering joins filter rows from x based on the presence or absence of matches in y: semi_join() return all rows

原创 R語言nest_join()函數

nest_join() returns all rows and columns in x with a new nested-df column that contains all matches from y. When t

原创 R語言一次性更新全部packages

install.packages( lib = lib <- .libPaths()[1], pkgs = as.data.frame(installed.packages(lib), stringsAsFac

原创 R語言行/列合併

bind_rows & bind_cols 這兩個命令是do.call(rbind, dfs)和do.call(cbind, dfs)的代替,使用起來更有效率。 one <- starwars[1:4, ] two <- star

原创 Bash 批量刪除指定後綴的文件

find . -type f -iname \*.jpg -delete -type 文件類型 -iname 區分大小寫 -delete 對符合條件的文件執行刪除命令 最好先運行不帶-delete的版本查看符合條件的文件。

原创 R語言 random forests out-of-bag prediction

out-of-bag prediction Created: Jun 29, 2020 12:22 PM Updated: Jun 29, 2020 12:28 PM https://stackoverflow.com/quest

原创 R語言 case_when 函數

case_when 要點有兩個 不匹配的時候會返回 NA,而不是保持不變 根據順序進行條件判斷,順序很重要 下面這段代碼, x <- 1:50 case_when( x %% 35 == 0 ~ "fizz buzz",

原创 R語言 ggplot2 柱狀圖

# library library(ggplot2) # create a dataset specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" ,

原创 R語言 ggplot2 筆記

legend 設置legend位置和title ggplot(df, aes(x, y, colour=g)) + geom_line(stat="identity") + theme(legend.position="

原创 R語言 dplyr selec 輔助函數

Tidyverse selections implement a dialect of R where operators make it easy to select variables: : for selecting a r

原创 R語言 coalesce 函數

兩個主要功能, 替換NA x <- c(2, 1, NA, 5, 3, NA) # Create example vector coalesce(x, 999) # Apply coal

原创 R語言 random forests 高性能庫

最忠實Leo Breiman算法的版本是 randomForest,但是這個庫不支持並行,性能也比較差。 有兩個優化後的替代版本,都支持並行計算。 ranger rborist