January 2019
Beginner to intermediate
336 pages
7h 58m
English
We will now look at how to use a random forest to train our model:
predictor= df_creditcarddata.iloc[:, df_creditcarddata.columns != 'default.payment.next.month']target= df_creditcarddata.iloc[:, df_creditcarddata.columns == 'default.payment.next.month']
# save all categorical columns in listcategorical_columns = [col for col in predictor.columns.values if predictor[col].dtype == 'object']# dataframe with categorical featuresdf_categorical = predictor[categorical_columns]# dataframe with numerical featuresdf_numeric = predictor.drop(categorical_columns, axis=1)