Learn practical skills, build real-world projects, and advance your career

AI for Medicine Course 3 Week 1 lecture notebook - Model Training/Tuning Basics with Sklearn

Welcome to this exercise! You're going to be exploring the sklearn library, including an overview of its underlying data types and methods for tweaking a model's hyperparameters. You'll be using the same data from the previous lecture notebook. Let's get started!

Packages

First import all the packages that you need for this assignment.

  • pandas is what you'll use to manipulate your data
  • numpy is a library for mathematical and scientific operations
  • sklearn has many efficient tools for machine learning and statistical modeling
  • itertools helps with hyperparameter (grid) searching

Import Packages

Run the next cell to import all the necessary packages.

# Import packages
import pandas as pd
import numpy as np
import itertools

# Set the random seed for consistent output
np.random.seed(18)

# Read in the data
data = pd.read_csv("dummy_data.csv", index_col=0)

Train/Test Split