เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Fit the folds

Now that you split your data into folds, it's time to use them for model training and calculating the out-of-sample error of every single model. This way, you gain a balanced estimation of the performance of your model specification because you evaluated it out-of-sample several times.

Provided in your workspace is chocolate_folds, which you created in the last exercise (10 folds of the chocolate training set).

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Machine Learning with Tree-Based Models in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Show that you can still do it: create tree_spec, a regression tree specification using an "rpart" engine.
  • Use fit_resamples() to fit your folds to tree_spec, modeling final_grade using all other predictors and evaluating with both MAE and RMSE.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Create a specification
tree_spec <- ___ %>%
    ___
    ___

# Fit all folds to the specification
fits_cv <- ___(tree_spec,
               ___,
               resamples = ___,
               metrics = ___)

fits_cv
แก้ไขและรันโค้ด