Web Analytics

missForest

⭐ 109 stars Thai by stekhoven

🌐 ภาษา

missForest

สถานะ CRAN จำนวนดาวน์โหลดจากกระจก RStudio CRAN เดือนล่าสุด จำนวนดาวน์โหลดจากกระจก RStudio CRAN รวมทั้งหมด R-CMD-check test-coverage License: GPL (≥ 2)-blue.svg)

missForest เป็นวิธีการแทนค่าข้อมูลที่ขาดหายแบบไม่พึ่งสมมติฐานสำหรับข้อมูลตารางแบบ ผสมประเภท ใน R โดยรองรับตัวแปรทั้ง เชิงตัวเลขและเชิงหมวดหมู่ พร้อมกันด้วยการฝึก random forest แบบวนซ้ำเพื่อทำนายค่าที่ขาดหายจากค่าที่สังเกตได้ ไม่ต้องตั้งสมมติฐานแบบชัดเจน ไม่ต้องทำ matrix factorization—แค่ใช้ baseline ทำนายที่แข็งแกร่งซึ่งใช้งานได้ดีทันที

แพคเกจนี้ยังมีเครื่องมือสำหรับวัดข้อผิดพลาดการแทนค่าข้อมูล สร้างข้อมูลขาดหายสำหรับการทดลอง และตรวจสอบประเภทตัวแปร


การติดตั้ง

# CRAN (recommended)
install.packages("missForest")

Development version (from GitHub)

install.packages("remotes")

remotes::install_github("stekhoven/missForest")


Quick start

library(missForest)

Example data

data(iris)

Introduce ~20% MCAR missingness

set.seed(81) iris_mis <- prodNA(iris, noNA = 0.20)

Impute with default backend (ranger)

imp <- missForest(iris_mis, xtrue = iris, verbose = TRUE)

Imputed data

head(imp$ximp)

Estimated OOB errors (NRMSE for numeric, PFC for factors)

imp$OOBerror

True error if xtrue was provided (for benchmarking only)

imp$error

การเลือกแบ็คเอนด์

# Legacy behavior using randomForest
imp_rf <- missForest(iris_mis, backend = "randomForest")

Explicitly use ranger with limited threads

imp_rg <- missForest(iris_mis, backend = "ranger", num.threads = 2)

การประมวลผลแบบขนาน

มีโหมดให้เลือกใช้สองแบบผ่าน parallelize:

# Not run:

library(doParallel)

registerDoParallel(2)

imp_vars <- missForest(iris_mis, parallelize = "variables", verbose = TRUE)

imp_fors <- missForest(iris_mis, parallelize = "forests", verbose = TRUE, num.threads = 2)


ภาพรวมของ API

missForest(xmis, ...)

ฟังก์ชันหลักสำหรับการเติมค่าที่ขาดหายไป

อาร์กิวเมนต์สำคัญ:

การแมปอาร์กิวเมนต์บางส่วนสำหรับ backend = "ranger":

ยูทิลิตี้

---

เคล็ดลับ & แนวปฏิบัติที่ดีที่สุด

  set.seed(123); imp <- missForest(x)
  ``
  • คุณสามารถลดค่า ntree ในระหว่างการสร้างต้นแบบเพื่อเร่งความเร็วในการทำซ้ำ
---

การอ้างอิง

หากคุณใช้ missForest กรุณาอ้างอิงดังนี้:

Stekhoven, D. J. & Bühlmann, P. (2012). MissForest—nonparametric missing value imputation for mixed-type data.* Bioinformatics, 28(1), 112–118. https://doi.org/10.1093/bioinformatics/btr597

คุณยังสามารถอ้างอิงแพ็คเกจนี้ได้เช่นกัน:

r citation("missForest") ``


Contributing

Issues and pull requests are welcome. Please include a minimal reproducible example when reporting bugs. For performance discussions, share small benchmarks and session info.


License

GPL (≥ 2)


Contact

Daniel J. Stekhoven — stekhoven@nexus.ethz.ch


--- Tranlated By Open Ai Tx | Last indexed: 2026-07-17 ---