<jupyter_start><jupyter_text>Stratified train and test split<jupyter_code>train_x, test_x, train_y, test_y = train_test_split(x, y, test_size=0.1, stratify=y, random_state=1)
scaler = StandardScaler()
scaled_train_x = scaler.fit_transform(train_x)
scaled_test_x = scaler.fit_transform(test_x)
# model = LogisticRegression()
# Training accuracy: 0.8419117647058824
# Testing accuracy: 0.9032258064516129

# model = DecisionTreeRegressor()
# Training accuracy: 1.0
# Testing accuracy: 0.8387096774193549

model = RandomForestClassifier(max_depth=4, n_estimators=50)
# Training accuracy: 1.0
# Testing accuracy: 0.9354838709677419

# model = KNeighborsClassifier(algorithm="brute", n_jobs=-1)
# Training accuracy: 0.8584905660377359
# Testing accuracy: 0.8241758241758241

# model = LinearSVC(C=0.0001)
# Training accuracy: 0.8308823529411765
# Testing accuracy: 0.8709677419354839
model.fit(scaled_train_x, train_y)
x_prediction = model.predict(scaled_train_x)
training_data_acc = accuracy_score(x_prediction, train_y)
training_data_acc
x_prediction = model.predict(scaled_test_x)
testing_data_acc = accuracy_score(x_prediction, test_y)
testing_data_acc<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09737510584250635, 'fraction_numerical': 0.12870448772226925, 'mean_word_length': 8.53225806451613, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '572488', 'license': 'MIT', 'n_tokens_mistral': 541, 'n_tokens_neox': 443, 'n_words': 75, 'path': 'Heart Disease Predictor.ipynb', 'repo_name': 'divpala1/Heart-Disease-Predictor', 'size': '1181'}