ANNAS TRI WIDAGDO/PORTFOLIO · 2026
VOL. 01 // TECHNICAL ARCHIVE
■annastriwidagdo.me
SOFTWARE ENGINEER·FULL-STACK WEB DEVELOPER·AI & MACHINE LEARNING ENTHUSIAST
ENTRY 001OPENING TECHNICAL ARCHIVE00% · 01 / 01
Skip to content
■annastriwidagdo.me
  • 01Home
  • 02About
  • 03Projects●
  • 04Blog
  • 05Contact
LANGEN/ID
■annastriwidagdo.me
  • Software Engineer
  • Full-Stack Web Developer
  • AI & Machine Learning Enthusiast
EMAILannastriw6@gmail.com↗ (opens in a new tab)LINKEDIN/in/annastriwidagdo↗ (opens in a new tab)GITHUB@annastriw↗ (opens in a new tab)CONTACTOpen Contact→

© 2026 Annas Tri Widagdo. Find the purpose. Build the solution.

←Back to Projects
06 // MACHINE LEARNING

Machine Learning Model for Heart Attack Risk Prediction

A machine learning decision-support prototype developed for iHealth Edu that estimates heart attack risk from patient data and delivers the result through a Flask API.

Role
Machine Learning Engineer
Period
June–August 2025
Status
Completed Prototype
Product Integration
iHealth Edu
View GitHub Repository↗
[01]

Project Gallery

Enlarge Image
Terminal inference response showing low-risk prediction, estimated probability, supporting factors, and top 5 feature weights.
Terminal view displaying 21 clinical, demographic, and lifestyle feature inputs prior to model inference.
Terminal inference response showing low-risk prediction, estimated probability, supporting factors, and top 5 feature weights.
Terminal view displaying 21 clinical, demographic, and lifestyle feature inputs prior to model inference.
Enlarge Image
[01]Structured patient input parameters comprising 21 demographic, clinical, and lifestyle variables prior to model inference.
01 / 02
[02]

Project Overview

I developed this project as the machine learning decision-support component integrated into the live iHealth Edu website for healthcare workers. Model development used A. Panday's 2025 Heart Attack Prediction in Indonesia dataset from Kaggle, containing 158,355 observations and 21 predictors.

The workflow covers data preparation, class balancing, model comparison, evaluation, and inference deployment. Random Forest was selected for its leading accuracy and ROC-AUC, then serialized and served through a Flask REST API deployed with Docker on Ubuntu.

Dataset Source: A. Panday, Heart Attack Prediction in Indonesia, Kaggle, 2025↗
[03]

My Contribution

  • 01Prepared the dataset by encoding five categorical features, scaling the predictors, creating a stratified 80:20 split, and applying SMOTE only to the training data.
  • 02Trained and compared Random Forest, Linear SVM, K-Nearest Neighbors, and Logistic Regression, with hyperparameter tuning focused on F1-score.
  • 03Selected Random Forest based on its accuracy and ROC-AUC, serialized the model and preprocessing artifacts with Joblib, and built a Flask REST API for inference.
  • 04Deployed the inference service with Docker on Ubuntu and integrated its prediction output into iHealth Edu for healthcare workers.

This project gave me experience in building a machine learning workflow from data preparation to real product integration.

■Tech Stack
  • Python
  • Scikit-learn
  • Pandas
  • SMOTE
  • Flask
  • Docker
[04]

System Scope

■01 // Data Preparation
  • 01158,355 observations
  • 0222 columns
  • 0321 predictors
  • 045 categorical features
  • 05No missing values
  • 06Stratified 80:20 split
  • 07SMOTE on training data only
■02 // Model Evaluation
ModelAccuracyPrecisionRecallF1-ScoreROC-AUCHighlights / Notes
Random Forest[Selected]71.93%64.12%68.15%0.66070.8015Selected model: highest accuracy (71.93%) and ROC-AUC (0.8015)
Logistic Regression———0.6618—Highest compared F1: 0.6618
K-Nearest Neighbors——70.40%——Highest compared Recall: 70.40%
Linear SVM—————Compared model with no metric added
Random Forest[Selected]
Accuracy71.93%
Precision64.12%
Recall68.15%
F1-Score0.6607
ROC-AUC0.8015

Selected model: highest accuracy (71.93%) and ROC-AUC (0.8015)

Logistic Regression
Accuracy—
Precision—
Recall—
F1-Score0.6618
ROC-AUC—

Highest compared F1: 0.6618

K-Nearest Neighbors
Accuracy—
Precision—
Recall70.40%
F1-Score—
ROC-AUC—

Highest compared Recall: 70.40%

Linear SVM
Accuracy—
Precision—
Recall—
F1-Score—
ROC-AUC—

Compared model with no metric added

Random Forest was selected because it produced the highest accuracy and ROC-AUC in the documented comparison.

■[CLAIM BOUNDARY // MEDICAL DECISION SUPPORT]

This prototype supports risk assessment and does not provide a clinical diagnosis or replace medical judgment.

■03 // Inference Integration
  • 01Joblib model and preprocessing artifacts
  • 02Flask REST API
  • 03Risk class and probability
  • 04Supporting factors
  • 05Global feature importance
  • 06Docker deployment on Ubuntu
  • 07iHealth Edu integration for healthcare workers