<jupyter_start><jupyter_text>Using gridsearch to find out the best n_estimators.<jupyter_code>from sklearn.model_selection import GridSearchCV
grid={"n_estimators": [10, 50, 100, 500, 1000]}
model_et = ExtraTreesClassifier(random_state=77,n_jobs=-1)
# without cv
gridswocv = GridSearchCV(model_et,grid,verbose=3)
gridswocv.fit(X_train,y_train)
gridswocv.cv_results_
results = []
names = []
for i in range(0,5):
  stri = 'split'+str(i)+'_test_score'
  names.append(str(i))
  results.append(gridswocv.cv_results_[stri])
plt.boxplot(results,labels = names, showmeans=True)
plt.show()
#This is for 100 DT withput CV
print('Extra Tree accuracy score: ',accuracy_score(y_test,y_extc))
print('Extra Tree confusion matrix heatmap: \n')
plt.figure(figsize = (10,7))
sns.heatmap(confusion_matrix(y_extc, y_test),annot=True, annot_kws={"size": 16},fmt = "d")
plt.show()
print('Extra Tree classification report \n',classification_report(y_test, y_extc))<jupyter_output>Extra Tree accuracy score:  0.9924166666666666
Extra Tree confusion matrix heatmap:
{'fraction_non_alphanumeric': 0.1326923076923077, 'fraction_numerical': 0.04326923076923077, 'mean_word_length': 8.131578947368421, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '457036', 'license': 'MIT', 'n_tokens_mistral': 421, 'n_tokens_neox': 381, 'n_words': 80, 'path': 'SCDD_Extra_Tree_Classifier.ipynb', 'repo_name': 'voyage215/surface-crack-detection', 'size': '1040'}