I preprocessed the heart‑disease dataset by converting categorical features into numeric form with one‑hot encoding, using pd.get_dummies(drop_first=True) to avoid multicollinearity, and then casting the resulting boolean columns to integers (1/0).
I used one‑hot encoding with drop_first=True.
I converted one‑hot columns from boolean to integer (1/0).
I split the data with test_size=0.2 and stratify=y to keep class balance.
I fitted the StandardScaler only on the training set before applying it to both train and test sets.
After preprocessing, I trained five classifiers and evaluated them on the held‑out test set. The K‑Nearest Neighbors model performed best.
The KNN model achieved an Accuracy of 0.8859.
The KNN model achieved an F1 Score of 0.8986.
I saved the final model, scaler, and column list as KNN_heart.pkl, scaler.pkl, and columns.pkl for later deployment. See heart disease prediction eda for the exploratory analysis.

