In this section, we will build and implement the code in our first ML model. We will use the diamond prices dataset. Before moving on, let's load the libraries we will use in this notebook:
import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport os%matplotlib inline
Now, load the diamonds dataset and apply the transformations we have done before:
DATA_DIR = '../data'FILE_NAME = 'diamonds.csv'data_path = os.path.join(DATA_DIR, FILE_NAME)diamonds = pd.read_csv(data_path)## Preparation done from Chapter 2diamonds = diamonds.loc[(diamonds['x']>0) | (diamonds['y']>0)]diamonds.loc[11182, 'x'] = diamonds['x'].median()diamonds = diamonds.loc[~((diamonds['y'] > 30) | (diamonds['z'] ...