<jupyter_start><jupyter_text>Models  LogisticRegression<jupyter_code>from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn import metrics
df.columns
TARGET = 'target'

FEATURES = [
    'age', 'sex', 'cp', 'trestbps', 'chol', 'fbs', 'restecg', 
    'thalach', 'exang', 'oldpeak', 'slope', 'ca', 'thal', 
]
x = df[FEATURES]
y = df[TARGET]

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.20, random_state=777)
x_train.shape, x_test.shape
logreg_model = LogisticRegression(max_iter=1000)
logreg_model.fit(x_train, y_train)
accuracy_score(y_test, logreg_model.predict(x_test))
sn.set(rc={'figure.figsize':(5, 5)})
metrics.plot_confusion_matrix(logreg_model, x_test, y_test)
from sklearn.ensemble import RandomForestClassifier
rf_model = RandomForestClassifier(max_depth=3, random_state=777)
rf_model.fit(x_train, y_train)
accuracy_score(y_test, rf_model.predict(x_test))
metrics.plot_confusion_matrix(rf_model, x_test, y_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12283894449499545, 'fraction_numerical': 0.014558689717925387, 'mean_word_length': 8.821428571428571, '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': '331390', 'license': 'MIT', 'n_tokens_mistral': 431, 'n_tokens_neox': 418, 'n_words': 74, 'path': 'ml_project/notebooks/EDA.ipynb', 'repo_name': 'made-ml-in-prod-2021/holyketzer', 'size': '1099'}