Exercise

Scikit-learn flavor and evaluation

In this exercise you will train a classification model and evaluates its performance. The model uses your Insurance Charges dataset in order to classify if the charges were for a female or male.

We will start by logging our model to MLflow Tracking using the scikit-learn flavor and finish by evaluating your model using an eval_data dataset.

Your evaluation dataset is created as eval_data and our model trained with the name lr_class. The eval_data will consist of X_test and y_test as the training data was split using train_test_split() function from sklearn.

# Model
lr_class = LogisticRegression()
lr_class.fit(X_train, y_train)

The mlflow module is imported.

Instructions

100 XP
  • Log the lr_class model using scikit-learn "built-in" flavor.
  • Set the evaluate() function from mlflow module.
  • Evaluate the eval_data dataset and target the "sex" column.