January 2018
Beginner to intermediate
412 pages
9h 33m
English
The final step after creating the model is to use the model against the test dataset to get the predictions. This is generally done using the predict function in R, with the first argument being the model that was created and the second argument being the dataset against which you'd like to get the predictions for.
Taking our example of the PimaIndiansDiabetes dataset, after the model has been built, we can get the predictions on the test dataset as follows:
# Install the R Package e1071, if you haven't already # By running install.packages("e1071") # Use the predict function and the rf_model that was previously built # To get the predictions on the test dataset # Note that we are not including the column diabetes in the ...Read now
Unlock full access