开始使用免费开始使用

Making predictions on new data

Finally, the model you fit with the train() function has the exact same predict() interface as the linear regression models you fit earlier in this chapter.

After fitting a model with train(), you can simply call predict() with new data, e.g:

predict(my_model, new_data)

本练习是课程的一部分

Machine Learning with caret in R

查看课程

练习说明

Use the predict() function to make predictions with model on the full Boston housing dataset. Print the result to the console.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Predict on full Boston dataset
编辑并运行代码