April 2019
Intermediate to advanced
426 pages
11h 13m
English
Before feeding the dataset into our model, we have to prepare it in a proper format. The following steps guide you through the process:
In [ ]: feature_columns= df.columns[:-1] features = df.loc[:, feature_columns] target = df.loc[:, 'default payment next month']
Our target values in the last column of the dataset are assigned to the target variable, while remaining values are feature values and are assigned to the features variable.
In [ ]: from sklearn.model_selection import train_test_split train_features, test_features, train_target, test_target = \ train_test_split(features, target, test_size=0.20, ...