Fitting the Model

Learn how to train a CART classification tree using tidymodels.

Training the model

The parsnip package contains many functions for using workflow objects to train machine learning models. This process is often called fitting a model to the data. The parsnip package names a function using this terminology.

The fit() function is used to produce a machine learning model. Other parsnip functions are available for more advanced scenarios (e.g., to fit models using cross-validation).

The following code trains a CART classification tree using the titanic_train data frame as the training data:

Get hands-on with 1200+ tech skills courses.