<jupyter_start><jupyter_text>Prepare<jupyter_code>dataset = datasets.load_digits()
X, y = dataset.data, dataset.target

clf = RandomForestClassifier(n_estimators=100, random_state=42)
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)<jupyter_output><empty_output><jupyter_text>Step 1: raw data<jupyter_code>score = cross_validate(clf, X, y, cv=skf)
score['test_score'].mean()<jupyter_output><empty_output><jupyter_text>Step 2: raw -> k-NN feature<jupyter_code>X_knn_feature_raw = knn_kfold_extract(X, y)
score = cross_validate(clf, X_knn_feature_raw, y, cv=skf)
score['test_score'].mean()<jupyter_output><empty_output><jupyter_text>Step 3: raw -> t-SNE feature<jupyter_code>tsne = TSNE()
X_transformed = tsne.fit_transform(X)
score = cross_validate(clf, X_transformed, y, cv=skf)
score['test_score'].mean()<jupyter_output><empty_output><jupyter_text>Step 4: raw -> t-SNE -> k-NN stacking<jupyter_code># pattern 4: raw -> t-SNE -> k-NN stacking
X_knn_feature_tsne = knn_kfold_extract(X_transformed, y)
score = cross_validate(clf, X_knn_feature_tsne, y, cv=skf)
score['test_score'].mean()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14146772767462423, 'fraction_numerical': 0.011494252873563218, 'mean_word_length': 9.780952380952382, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '44172', 'license': 'Apache-2.0', 'n_tokens_mistral': 483, 'n_tokens_neox': 464, 'n_words': 66, 'path': 'examples/classification_digits.ipynb', 'repo_name': 'momijiame/gokinjo', 'size': '1131'}