<jupyter_start><jupyter_text>Set Paths<jupyter_code>proj_path = Path().absolute().parents[0]
data_raw_path = Path(proj_path, 'data', 'raw')<jupyter_output><empty_output><jupyter_text>Read in data<jupyter_code>df = pd.read_csv(Path(data_raw_path, 'datasets_19_420_Iris.csv'))<jupyter_output><empty_output><jupyter_text>Process data<jupyter_code># Split into feature and response
X = df.iloc[:, 1:5]
y = df.iloc[:, 5]
# Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)<jupyter_output><empty_output><jupyter_text>Build model<jupyter_code>rf = RandomForestClassifier(oob_score=True)
rf.fit(X_train, y_train)
pred = rf.predict(X_test)
pred_proba = rf.predict_proba(X_test)<jupyter_output><empty_output><jupyter_text>Model performance (Test)<jupyter_code># Test error
print(
    classification_report(y_true=y_test.values, 
                      y_pred=pred)
)
print(
    confusion_matrix(y_true=y_test, 
                      y_pred=pred)
)<jupyter_output>[[15  0  0]
 [ 0 11  0]
 [ 0  0 12]]<jupyter_text>Model performance (Train)<jupyter_code># Training error
print(
    classification_report(y_true=y_train, 
                      y_pred=rf.predict(X_train))
)
print(
    confusion_matrix(y_true=y_test, 
                      y_pred=pred)
)<jupyter_output>[[15  0  0]
 [ 0 11  0]
 [ 0  0 12]]
{'fraction_non_alphanumeric': 0.1274074074074074, 'fraction_numerical': 0.028148148148148148, 'mean_word_length': 4.925438596491228, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '130185', 'license': 'FTL', 'n_tokens_mistral': 574, 'n_tokens_neox': 538, 'n_words': 79, 'path': 'notebooks/1.0-hwant-iris-exploration.ipynb', 'repo_name': 'howewenann/docker_proj', 'size': '1350'}