<jupyter_start><jupyter_text>_Hmm...a perfect score. Maybe the model has overfit, so we will use a validation set._<jupyter_code>def split_vals(a, n): return a[:n].copy(), a[n:].copy()
df['Name']
n_valid = 418
n_trn = len(df)-n_valid
raw_train, raw_valid = split_vals(df_raw, n_trn)
X_train, X_valid = split_vals(df, n_trn)
y_train, y_valid = split_vals(y, n_trn)

X_train.shape, y_train.shape, X_valid.shape
def print_score(m):
    res = [m.score(X_train, y_train), m.score(X_valid, y_valid)]
    print(res) 
m = RandomForestClassifier(n_jobs=-1)
%time m.fit(X_train, y_train)
print_score(m)<jupyter_output>CPU times: user 213 ms, sys: 32.8 ms, total: 246 ms
Wall time: 262 ms
[1.0, 0.8444976076555024]
{'fraction_non_alphanumeric': 0.14366998577524892, 'fraction_numerical': 0.049786628733997154, 'mean_word_length': 5.704761904761905, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '425459', 'license': 'MIT', 'n_tokens_mistral': 329, 'n_tokens_neox': 301, 'n_words': 70, 'path': 'kaggle/Titanic.ipynb', 'repo_name': 'samisnotinsane/ML-Notebooks', 'size': '703'}