<jupyter_start><jupyter_text>Analyze Model Correctness<jupyter_code>preds = predict_xgb(clr, x_train)
df_report = pd.DataFrame()
df_report['id'] = df_train['id']
df_report['sent1'] = df_train['sent1']
df_report['sent2'] = df_train['sent2']
df_report['pred'] = preds
df_report['y'] = df_train['same_source']
df_report['diff'] = abs(df_report['y'] - df_report['pred'])
df_report.sort_values(by=['diff'],inplace=True)
df_report<jupyter_output><empty_output><jupyter_text>Analyze Feature Separation<jupyter_code>report = x_train.copy()
report['y'] = y_train
grp = report.groupby(by=['y']).mean()
grp<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1824, 'fraction_numerical': 0.0064, 'mean_word_length': 12.041666666666666, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '464112', 'license': 'Apache-2.0', 'n_tokens_mistral': 252, 'n_tokens_neox': 252, 'n_words': 30, 'path': 'NLP Kaggle Project/Feature_engineering_xgboost.ipynb', 'repo_name': 'Cong-Nie/GitHub-Demo', 'size': '625'}