<jupyter_start><jupyter_text>Table of Contents1&nbsp;&nbsp;GS summary2&nbsp;&nbsp;Bert Summary  GS summary<jupyter_code>from glob import glob
import pandas as pd
output_path = '../Report/v2/'
gs = pd.DataFrame()
for file in glob('./GridSearch_result_v2/*.xlsx')[0:]:
    print(file)
    tmp = pd.read_excel(file, index_col=0)
    tmp['file'] = file
    gs = pd.concat([gs, tmp], ignore_index=True, axis=0)
gs
gs['rank_of_all'] = gs['mean_test_score'].rank(ascending=False)
gs = gs.sort_values(by='rank_of_all').reset_index()

def clean_filename(x):
    x = x.replace('_cv_result_Classification_svm_nb_baseline','')
    x = x.replace('.\\','')
    x = x.replace('.xlsx','')
    x = x.replace('.ipynb','')
    return x

gs['model_preprocessing'] = gs['file'].apply(lambda x: clean_filename(x))
gs.to_excel(output_path+"gs_all.xlsx")
gs_res = gs.groupby('file').first().sort_values(by='rank_of_all').round(3)
gs_res.columns


gs_res.to_excel(output_path+"gs_summary_detail.xlsx")
gs_res = gs_res[['model_preprocessing','rank_of_all', 'params', 'mean_fit_time','mean_test_score','std_test_score']]
gs_res.to_excel(output_path+"gs_summary_to_report.xlsx")
gs_res<jupyter_output><empty_output><jupyter_text>Bert Summary<jupyter_code>data = pd.read_csv('bert_clf.csv')
data
import matplotlib.pyplot as plt
print("========================================================================")
xx = list(range(1, len(data) + 1))
plt.plot(xx, data.train_acc, color='navy', lw=2, label='Model_train_acc')
plt.plot(xx, data.val_acc, color='darkorange', lw=2, label='Model_val_acc')
plt.title("train_acc v.s. val_acc")
plt.xlabel('Epochs')
plt.ylabel('acc')
plt.title('Finetune BERT training accuracy')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
print("========================================================================")
xx = list(range(1, len(data) + 1))
plt.plot(xx, data.train_loss, color='navy', lw=2, label='Model_train_loss')
plt.plot(xx, data.val_loss, color='darkorange', lw=2, label='Model_val_loss')
plt.title("train_loss v.s. val_loss")
plt.xlabel('Epochs')
plt.ylabel('loss')
plt.title('Finetune BERT training loss')
plt.legend()
plt.show()<jupyter_output>========================================================================
{'fraction_non_alphanumeric': 0.2603655818100758, 'fraction_numerical': 0.007133303611234953, 'mean_word_length': 7.904761904761905, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '42363', 'license': 'MIT', 'n_tokens_mistral': 856, 'n_tokens_neox': 818, 'n_words': 128, 'path': 'code/models_summary.ipynb', 'repo_name': 'InscribeDeeper/Text-Classification', 'size': '2243'}