Hands-on basic baseline ML
Now that we have a working environment let’s create and step through a Jupyter notebook, implementing and demonstrating the foundational concepts we learned in our previous chapter. The notebook is called basic-ml.ipynb
and uses Wine
, a sample dataset that comes with scikit-learn
. The Wine
dataset has 13 different attributes of a wine sample and an associated classification (Class_1
, Class_2
, Class_3
). We will first use the sample dataset to show some basic data exploration techniques, such as printing feature names, target labels, target names, and a data preview:
from sklearn import datasets import numpy as np # Load the wine dataset wine = datasets.load_wine() # Convert to pandas DataFrame df = pd.DataFrame(data=np.c_[wine['data'], wine['target']], columns=wine['feature_names'] + ['target']) print("Features:",df.columns.tolist()[::-1]) print("Targets:",df.target.unique()); print("...