Web Analytics

missForest

⭐ 105 stars Japanese by stekhoven

missForest

CRAN status CRAN RStudio mirror downloads CRAN RStudio mirror downloads R-CMD-check test-coverage License: GPL (≥ 2)-blue.svg)

missForest は、Rにおける混合型表形式データの非パラメトリックな補完手法です。数値変数とカテゴリ変数を同時に扱い、観測データから欠損値を予測するランダムフォレストを反復的に学習させます。明示的なモデル仮定や行列分解は不要で、すぐに使える強力な予測ベースラインを提供します。

このパッケージには、補完誤差の測定、実験用の欠損生成、変数型の検査に役立つユーティリティも含まれています。


インストール

# 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 には2つのモードがあります:

# 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—混合型データのための非パラメトリック欠損値補完手法.* 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: 2025-12-08 ---