Introduction to Machine Learning with Python - Guido Percu's Notes
← Back to Garden

Introduction to Machine Learning with Python

📅 May 21, 2026 📁 books 🌱

Introduction to Machine Learning with Python

Kindle Highlights

pip install numpy scipy matplotlib ipython scikit-learn pandas

import numpy as np import matplotlib.pyplot as plt import pandas as pd import mglearn

%matplotlib notebook or %matplotlib inline magic enabled to show plots. If you are not using the notebook or these magic commands, you will have to call plt.show to actually show any of the figures.

There is also a video course created by Andreas Müller, “Advanced Machine Learning with scikit-learn,” that supplements this book. You can find it at http://bit.ly/advanced_machine_learning_scikit-learn.

Remember that the individual items are called samples in machine learning, and their properties are called features. The shape of the data array is the number of samples multiplied by the number of features. This is a convention in scikit-learn, and your data will always be assumed to be in this shape.

Meet the Data The data we will use for this example is the Iris dataset, a classical dataset in machine learning and statistics. It is included in scikit-learn in the datasets module. We can load it by calling the load_iris function: In[10]: from sklearn.datasets import load_iris iris_dataset = load_iris() The

following questions: What question(s) am I trying to answer? Do I think the data collected can answer that question? What is the best way to phrase my question(s) as a machine learning problem? Have I collected enough data to represent the problem I want to solve? What features of the data did I extract, and will these enable the right predictions? How will I measure success in my application? How will the machine learning solution interact with other parts of my research or business product?