-
-
Save amankharwal/d5d6dc5569eaafb6dfc81e625add3b8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X_features = ['Total_Trans_Ct','PC-3','PC-1','PC-0','PC-2','Total_Ct_Chng_Q4_Q1','Total_Relationship_Count'] | |
X = usampled_df_with_pcs[X_features] | |
y = usampled_df_with_pcs['Churn'] | |
train_x,test_x,train_y,test_y = train_test_split(X,y,random_state=42) | |
rf_pipe = Pipeline(steps =[ ('scale',StandardScaler()), ("RF",RandomForestClassifier(random_state=42)) ]) | |
f1_cross_val_scores = cross_val_score(rf_pipe,train_x,train_y,cv=5,scoring='f1') | |
rf_pipe.fit(train_x,train_y) | |
rf_prediction = rf_pipe.predict(test_x) | |
print('F1 Score of Random Forest Model On Test Set - {}'.format(f1(rf_prediction,test_y))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment