Back to blog

Apple Watch and AI: How 3 Million Days of Data Are Training Models to Detect Diseases

Hello HaWkers, imagine if your watch could warn you that you are at risk for hypertension before you even show symptoms. This is no longer science fiction. MIT researchers and Empirical Health company used 3 million accumulated days of Apple Watch data to train an AI model capable of detecting medical conditions with impressive accuracy.

Let us explore how this technology works, what it means for the future of preventive medicine and the implications for developers interested in healthtech.

What Was Discovered

The recently published research presents significant advances in early disease detection using wearable data:

Research Numbers

Data Used:

  • 3 million person-days of Apple Watch data
  • 2.5 billion hours of behavioral data
  • More than 160,000 participants from Heart and Movement Study
  • 57 different health prediction tasks tested

Accuracy Achieved:

  • Hypertension: AUC of 0.88 (88% accuracy)
  • Sleep apnea: detection with high accuracy
  • Chronic conditions: identification before clinical symptoms

How AI Detects Diseases

The model uses a different approach from traditional methods:

Behavioral Data vs Sensors

Traditional Methods:

  • Focus on direct sensor readings
  • Real-time heart rate
  • Blood oxygen (SpO2)
  • Point-in-time ECG

New Approach (Wearable Behavior Model):

  • Analyzes behavioral patterns over time
  • Step count and movement patterns
  • Gait stability
  • Estimated VO2 max
  • Sleep patterns
  • Physical activity levels

The I-JEPA Model

The AI model called I-JEPA uses self-supervised learning:

Advantages:

  • Does not need perfectly labeled data
  • Works even with incomplete or irregular data
  • Learns complex behavioral patterns
  • Interpolates information when there are gaps

Why Behavior Matters More

The big discovery is that behavioral patterns over time reveal more about your health than point measurements:

Practical Example:

  • Your resting heart rate today: not very informative
  • How your heart rate changed in the last 6 months: very informative
  • Correlation between sleep, exercise and cardiac metrics: highly predictive

Apple Wearable Behavior Model (WBM)

Apple has also developed its own model:

Metrics Analyzed

WBM analyzes high-level metrics produced by Apple Watch:

Data Collected:

  • Daily step count
  • Gait stability
  • Overall mobility
  • Estimated VO2 max
  • Sleep time
  • Sleep quality
  • Standing time
  • Exercises performed

Impressive Results

Reported Accuracy:

  • Up to 92% accuracy in some conditions
  • Surpasses many clinical benchmarks
  • Works with existing data (no new sensors)

Availability

Apple plans to make health alerts available via software update:

Timeline:

  • watchOS 26: hypertension alerts
  • Compatible with: Series 9, Series 10, Ultra 2
  • Reach: 100 million active Apple Watch users

Implications for Developers

If you work with technology, especially in health-adjacent areas, this research opens opportunities:

1. Health APIs

Apple exposes health data via HealthKit:

import HealthKit

class HealthDataManager {
    let healthStore = HKHealthStore()

    func requestAuthorization() {
        let typesToRead: Set<HKObjectType> = [
            HKObjectType.quantityType(forIdentifier: .stepCount)!,
            HKObjectType.quantityType(forIdentifier: .heartRate)!,
            HKObjectType.quantityType(forIdentifier: .vo2Max)!,
            HKObjectType.categoryType(forIdentifier: .sleepAnalysis)!,
            HKObjectType.quantityType(forIdentifier: .walkingStepLength)!
        ]

        healthStore.requestAuthorization(
            toShare: nil,
            read: typesToRead
        ) { success, error in
            if success {
                self.fetchHealthData()
            }
        }
    }

    func fetchHealthData() {
        // Fetch data from last 30 days
        let calendar = Calendar.current
        let endDate = Date()
        let startDate = calendar.date(
            byAdding: .day,
            value: -30,
            to: endDate
        )!

        let predicate = HKQuery.predicateForSamples(
            withStart: startDate,
            end: endDate,
            options: .strictStartDate
        )

        // Query for steps
        let stepsQuery = HKStatisticsCollectionQuery(
            quantityType: HKQuantityType.quantityType(
                forIdentifier: .stepCount
            )!,
            quantitySamplePredicate: predicate,
            options: .cumulativeSum,
            anchorDate: startDate,
            intervalComponents: DateComponents(day: 1)
        )

        healthStore.execute(stepsQuery)
    }
}

2. ML Models for Wearables

You can train your own models using health data:

import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score

class HealthPredictionModel:
    def __init__(self):
        self.model = RandomForestClassifier(
            n_estimators=100,
            max_depth=10,
            random_state=42
        )

    def prepare_features(self, health_data: pd.DataFrame):
        """
        Transform raw data into behavioral features
        """
        features = pd.DataFrame()

        # Temporal aggregations
        features['avg_steps_7d'] = health_data['steps'].rolling(7).mean()
        features['std_steps_7d'] = health_data['steps'].rolling(7).std()

        # Trends
        features['steps_trend'] = (
            health_data['steps'].diff(7) /
            health_data['steps'].shift(7)
        )

        # Sleep patterns
        features['avg_sleep_hours'] = health_data['sleep_minutes'] / 60
        features['sleep_consistency'] = (
            health_data['sleep_minutes'].rolling(7).std()
        )

        # Cardiac metrics
        features['resting_hr_trend'] = (
            health_data['resting_hr'].diff(30)
        )
        features['hr_variability'] = (
            health_data['hr_max'] - health_data['hr_min']
        )

        return features.dropna()

    def train(self, X: pd.DataFrame, y: pd.Series):
        X_train, X_test, y_train, y_test = train_test_split(
            X, y, test_size=0.2, random_state=42
        )

        self.model.fit(X_train, y_train)

        # Evaluate model
        y_pred_proba = self.model.predict_proba(X_test)[:, 1]
        auc = roc_auc_score(y_test, y_pred_proba)

        print(f"AUC Score: {auc:.3f}")
        return auc

    def predict_risk(self, features: pd.DataFrame):
        return self.model.predict_proba(features)[:, 1]

3. Practical Applications

Areas where developers can contribute:

Wellness Apps:

  • Integration with HealthKit/Google Fit
  • Personalized trend analysis
  • Pattern-based alerts

Telemedicine:

  • Dashboards for doctors to monitor patients
  • Automatic anomaly alerts
  • Detailed health histories

Fitness:

  • Training recommendations based on recovery
  • Overtraining detection
  • Sleep optimization for performance

Ethical and Privacy Considerations

Working with health data requires special care:

Regulations

HIPAA (USA):

  • Health data is protected information
  • Requires explicit consent
  • Severe penalties for leaks

GDPR (Europe):

  • Health data is sensitive
  • Special treatment required
  • User must be able to revoke consent

Best Practices

For Developers:

  • Process data locally when possible
  • Anonymize before sending to servers
  • Encryption in transit and at rest
  • Data access auditing

The Future of Preventive Health

This technology points to a future where:

Predictive Medicine

Scenario 2025-2030:

  • Wearables detect conditions months before symptoms
  • Preventive treatment becomes standard
  • Health costs significantly reduced

Total Personalization

What to Expect:

  • Individualized health recommendations
  • Medications dosed based on real data
  • Diets and exercises optimized by AI

Remaining Challenges

Obstacles:

  • Unequal access to technology
  • Rigorous clinical validation needed
  • Integration with traditional health systems
  • Legal liability issues

Conclusion

The research with Apple Watch data represents a milestone in preventive medicine. The combination of ubiquitous wearables with advanced AI can transform how we detect and treat diseases.

For developers, it is an area with enormous potential. Whether creating wellness apps, contributing to research or developing tools for healthcare professionals, the opportunities are vast.

The watch on your wrist may be much more than an accessory - it can be your personal health guardian.

If you want to explore other areas where AI is transforming industries, I recommend checking out the article Adobe Brings Photoshop to ChatGPT to see how AI is changing design.

Lets go! 🦅

Comments (0)

This article has no comments yet 😢. Be the first! 🚀🦅

Add comments