Rabiat Sadiq

Apple NACME AIML Intensive β€’ iOS + ML β€’ Health

Assuage: ML Distress Prediction

Built a logistic regression model to predict distress levels from HealthKit biometrics, achieving 82% test accuracy. Implemented on-device inference in Swift using Core ML for privacy-preserving health monitoring.

Accuracy

82% test accuracy

Deployment

Core ML on-device

Platform

iOS + HealthKit

Problem

Early detection of distress or health issues can help individuals take proactive measures. However, collecting and analyzing health data while maintaining privacy is challenging. This project aimed to create a privacy-preserving solution that uses on-device machine learning to predict distress levels from readily available HealthKit biometrics.

Approach

Technical Implementation

# Python: Model training
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

# Feature engineering from HealthKit data
features = ['heart_rate', 'steps', 'sleep_hours', 'active_energy']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Train model
model = LogisticRegression()
model.fit(X_train, y_train)

# Evaluate
accuracy = accuracy_score(y_test, model.predict(X_test))
# Result: 82% accuracy

# Convert to Core ML
import coremltools as ct
coreml_model = ct.converters.sklearn.convert(model)
coreml_model.save('DistressPredictor.mlmodel')

// Swift: On-device inference
import CoreML
import HealthKit

let model = try DistressPredictor(configuration: .init())
let input = DistressPredictorInput(
    heartRate: currentHeartRate,
    steps: todaySteps,
    sleepHours: lastNightSleep,
    activeEnergy: todayActiveEnergy
)
let prediction = try model.prediction(from: input)
let distressLevel = prediction.distressLevel

Results

Technologies Used

Swift HealthKit Core ML Python scikit-learn EDA Xcode iOS

Impact

This project demonstrates how machine learning can be applied to health monitoring in a privacy-preserving way. By using on-device inference, users can benefit from ML-powered insights without compromising their privacy. The approach can be extended to other health prediction tasks and integrated into health monitoring apps.

GitHub Repository β†—

Back to Projects LinkedIn