5.1. Exercises

Multi-Class Questions

Use the following coefficient output to answer the questions below:

              Forward   Guard      Other
weight      -0.031025 -0.193441  0.224466
height       0.227869 -1.358500  1.130631
draft_year  -0.017517  0.010280  0.007237
draft_round  0.250149  0.501243 -0.751392
draft_peak  -0.006979 -0.005453  0.012432

True or False: Coefficients

Multi Class Revisited

Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.

When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.

Make sure you remove the hash (#) symbol in the coding portions of this question. We have commented them so that the line won’t execute and you can test your code after each step.

Bringing back the Basketball dataset, we are going to take a look at how we assess the predictions from a logistic regression model.

Tasks:

  • Build and fit a pipeline containing the column transformer and a logistic regression model. Name this pipeline lr_pipe.
  • Fit your pipeline on the training data.
  • Plot a confusion matrix for the test set prediction results and answer the questions below.
Hint 1
  • Are you making your lr_pipe pipeline with make_pipeline(col_transformer,LogisticRegression())?
  • Are you Fitting your pipeline on the training set with lr_pipe.fit(X_train, y_train)?
  • Are you plotting your confusion matrix with plot_confusion_matrix(lr_pipe, X_test, y_test,cmap="PuRd");
Fully worked solution: