Dự đoán sau khi bạn huấn luyện mô hình

Học có giám sát với R: Hồi quy

Nina Zumel and John Mount

Win-Vector LLC

Dự đoán từ dữ liệu huấn luyện

cricket$prediction <- predict(cmodel)
  • Mặc định, predict() trả về dự đoán trên dữ liệu huấn luyện
Học có giám sát với R: Hồi quy

Xem các dự đoán

ggplot(cricket, aes(x = prediction, y = temperature)) + 
     geom_point() +
     geom_abline(color = "darkblue") + 
     ggtitle("temperature vs. linear model prediction")

Học có giám sát với R: Hồi quy

Dự đoán trên dữ liệu mới

newchirps <- data.frame(chirps_per_sec = 16.5)
newchirps$prediction <- predict(cmodel, newdata = newchirps)
newchirps
   chirps_per_sec     pred
 1           16.5 79.53537

Học có giám sát với R: Hồi quy

Cùng luyện tập nào!

Học có giám sát với R: Hồi quy

Preparing Video For Download...