<jupyter_start><jupyter_text>loading standardized data<jupyter_code>xtrain_norm= pd.read_csv("Data/x_train_norm.csv")
xtest_norm= pd.read_csv("Data/x_test_norm.csv")
y_train= pd.read_csv("Data/y_train.csv")
y_test= pd.read_csv("Data/y_test.csv")
xtrain_norm
xtest_norm
#y_train = y_train.to_numpy()
y_train = np.ravel(y_train)
xtest_norm.shape
y_test= np.ravel(y_test)
model4 = rf.fit(xtrain_norm, y_train)
predict4= model4.predict(xtrain_norm)
accuracy_score(y_train, predict4)
pred4= model4.predict(xtest_norm)
accuracy_score(y_test, pred4)
model5= grid.fit(xtrain_norm, y_train)
model5.best_score_
model5.best_params_
pred5= model5.predict(xtest_norm)
accuracy_score(y_test, pred5)<jupyter_output><empty_output><jupyter_text>Standardizing data<jupyter_code>minmax= MinMaxScaler()
train_norm= minmax.fit_transform(xtrain)
test_norm= minmax.transform(xtest)
model6= rf.fit(train_norm, ytrain)
predict6= model6.predict(train_norm)
accuracy_score(ytrain, predict6)
pred6= model6.predict(test_norm)
accuracy_score(ytest, pred6)
model7= grid.fit(train_norm, ytrain)
model7.best_score_
pred7= model7.predict(test_norm)
accuracy_score(ytest, pred7)<jupyter_output><empty_output><jupyter_text>Loading feature selection data<jupyter_code>selection= pd.read_csv("Data/selection_variables.csv")
selection.shape
selection
x= selection.iloc[:, 0:10]
y= selection["TARGET"]
features_train, features_test, target_train, target_test= train_test_split(x, y, 
                                                                           test_size= 0.25, 
                                                                           random_state= 100) 
features_train, target_train= smote.fit_resample(features_train, target_train)
features_train.shape
model8= rf.fit(features_train, target_train)
predict8= model8.predict(features_train)
accuracy_score(target_train, predict8)
pred8= model8.predict(features_test)
accuracy_score(target_test, pred8)
confusion_matrix(target_test, pred8)
model9= grid.fit(features_train, target_train)
model9.best_score_
model9.best_params_
pred9= model9.predict(features_test)
accuracy_score(target_test, pred9)
confusion_matrix(target_test, pred9)
predict10= model9.predict(features_train)
accuracy_score(target_train, predict10)
confusion_matrix(target_train, predict10)
features_test, target_test= smote.fit_resample(features_test, target_test)
pred10= model9.predict(features_test)
accuracy_score(target_test, pred10)
confusion_matrix(target_test, pred10)
result = pd.DataFrame(model9.cv_results_)
result = result[['mean_fit_time', 'std_fit_time', 'mean_score_time', 'std_score_time',
                'mean_test_score', 'std_test_score', 'rank_test_score']]
result.sort_values(['rank_test_score'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1057236602260299, 'fraction_numerical': 0.023332118118847976, 'mean_word_length': 6.476839237057221, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '421960', 'license': 'MIT', 'n_tokens_mistral': 997, 'n_tokens_neox': 976, 'n_words': 141, 'path': 'student_classification/create_model_RandomForest.ipynb', 'repo_name': 'hsdaniel86/machine_learning-classification', 'size': '2743'}