March 2019
Beginner to intermediate
464 pages
10h 57m
English
Similar to the previous chapter, we are going to split the sample set into train and test sets, using the following code:
from sklearn.model_selection import train_test_splittarget_var = 'CLV_'+clv_freqall_features = [x for x in sample_set_df.columns if x not in ['CustomerID', target_var]]x_train, x_test, y_train, y_test = train_test_split( sample_set_df[all_features], sample_set_df[target_var], test_size=0.3)
As you can see from this code, we are taking 70% of the sample set for training the model and the remaining 30% for testing and evaluating the model performance. In this section, we will be using a linear regression model. However, we recommend experimenting with other machine learning algorithms, such as random ...
Read now
Unlock full access