Exercises

Complete the following exercises to practice the skills covered in this chapter. Be sure to consult the Machine learning workflow section in the appendix as a refresher for the process of building models:

  1. Predict star temperature with elastic net linear regression as follows:
    1. Using the data/stars.csv file, build a pipeline to normalize the data with the MinMaxScaler and then run elastic net linear regression using all the numeric columns to predict the temperature of the star.
    2. Run grid search on the pipeline to find the best values for alpha, l1_ratio, and fit_intercept for the elastic net in the search space of your choice.
    3. Train the model on 75% of the initial data.
    4. Calculate the R2 of your model.
    5. Find the coefficients for each ...

Get Hands-On Data Analysis with Pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.