コースへようこそ

Rで学ぶ caret を使った Machine Learning

Max Kuhn

Software Engineer at RStudio and creator of caret

教師あり学習

  • R の caret パッケージ
  • 教師あり学習(予測モデリング)を自動化
  • 目的変数

花と「期限超過」と記された請求書の画像。

Rで学ぶ caret を使った Machine Learning

教師あり学習

  • 予測モデルは2種類
    • 分類 ⇒ 質的
    • 回帰 ⇒ 量的
  • モデルは指標で評価
    • 定量的
    • 客観的
  • 回帰には二乗平均平方根誤差(RMSE)
Rで学ぶ caret を使った Machine Learning

モデル性能の評価

  • インサンプルRMSEはよく計算される
    • 楽観的すぎる
    • 過学習を招く
  • アウトオブサンプル誤差(caret 方式)が望ましい
    • 実運用を模擬
    • 過学習を回避
Rで学ぶ caret を使った Machine Learning

インサンプル誤差

# Fit a model to the mtcars data
data(mtcars)
model <- lm(mpg ~ hp, mtcars[1:20, ])
# Predict in-sample
predicted <- predict(
  model, mtcars[1:20, ], type = "response"
)
# Calculate RMSE
actual <- mtcars[1:20, "mpg"]
sqrt(mean((predicted - actual) ^ 2))
3.172132
Rで学ぶ caret を使った Machine Learning

演習に進みましょう!

Rで学ぶ caret を使った Machine Learning

Preparing Video For Download...