/ Модель

Характеристики

Лицензия
CC BY 4.0
Библиотека
pytorch
Опубликована
16 ноя 2026

diabai-glucose-forecasting-lstm

Прогноз временных рядовTime_series → time_series3 профессии

Компактная LSTM прогнозирует изменение уровня глюкозы CGM на 30 минут вперёд по суточной последовательности измерений и предназначена для учебных и исследовательских экспериментов.

0скачиваний за 30 дней0лайковвеса обновлены16 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

DiabAI 30-Minute Glucose LSTM — небольшая модель PyTorch, разработанная для образовательных демонстраций и экспериментов с прогнозированием уровня глюкозы по данным непрерывного мониторинга (CGM). Однослойная LSTM с 19 617 обучаемыми параметрами принимает 96 последовательных показаний с интервалом 15 минут за последние 24 часа, нормализованные значения глюкозы и их первые разности, а также время суток и индикатор T1DM. Она предсказывает изменение глюкозы за 30 минут; к текущему значению прибавляется прогнозируемое изменение, результат выдаётся в мг/дл.

Модель предназначена для учебных демонстраций, воспроизводимых исследований и ретроспективных экспериментов с прогнозами CGM, а также для неклинических прототипов с проверкой человеком. Она обучена на наборах ShanghaiT1DM и ShanghaiT2DM; автор сообщает о тестировании на отложенных пациентах. Лицензия модели — CC BY 4.0.

Это не медицинское устройство: модель нельзя использовать для диагностики, лечения, обнаружения неотложных состояний или расчёта доз инсулина, а прогноз не должен влиять на решения о лекарствах, питании или физической активности. Данные получены от ограниченной китайской клинической когорты, участники с T1DM представлены существенно меньше, чем с T2DM; переносимость на другие популяции и устройства не установлена. Для работы требуется полная последовательность за 24 часа без пропусков; события приёма пищи, инсулина, активности, стресса и болезни не являются входами. Ошибка выше при фактической глюкозе свыше 180 мг/дл, а низкая средняя ошибка не гарантирует безопасность отдельного прогноза.

Сценарии применения

  • ретроспективный прогноз глюкозы CGM на 30 минут
  • демонстрация LSTM для прогнозирования медицинских временных рядов
  • сравнение моделей прогноза глюкозы на данных T1DM и T2DM
  • создание неклинического прототипа прогноза CGM с проверкой человеком

Ограничения

Модель не предназначена для клинических решений, диагностики, лечения или расчёта инсулина; её обобщаемость ограничена китайской когортой, а T1DM представлен недостаточно. Требуется полная последовательность из 96 измерений с шагом 15 минут; модель не учитывает события вроде еды и инсулина, а точность хуже при глюкозе выше 180 мг/дл.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

DiabAI 30-Minute Glucose LSTM

This educational PyTorch model forecasts continuous glucose monitor (CGM) glucose 30 minutes ahead using the previous 24 hours of 15-minute glucose readings, time of day, and diabetes cohort.

The LSTM predicts glucose change:

predicted future glucose = current glucose + predicted 30-minute change

Model architecture

  • One-layer LSTM
  • Two sequence channels: normalized glucose and normalized first difference
  • Sequence length: 96 readings (24 hours)
  • Hidden size: 64
  • Static inputs: hour sine, hour cosine, and T1DM indicator
  • Prediction head: 67 to 32 to 1
  • Dropout: 0.1
  • Trainable parameters: 19,617
  • Forecast horizon: 30 minutes
  • Output unit: mg/dL

Input

example_input.json demonstrates the required schema:

{
  "glucose_history_mg_dl": ["exactly 96 numbers, oldest to newest"],
  "current_timestamp": "2026-11-16T18:00:00+03:00",
  "diabetes_type": "T1DM or T2DM"
}

The readings must represent consecutive 15-minute measurements. The final value is treated as the current glucose. Missing readings are not imputed by the inference helper.

Training data

Recordings were placed on an exact 15-minute grid. Sequences never crossed recording gaps. Patients, rather than individual rows, were assigned to splits. Normalization statistics were calculated from the original training split.

No raw patient data is included in this repository.

Model selection

CNN, LSTM, and Transformer models received the same sequence inputs and patient splits. Validation MAE was declared the primary selection metric.

ModelValidation MAERMSER²
CNN8.460112.06010.9470
LSTM8.459912.10970.9466
Transformer8.463912.19050.9459

The results are practically tied. LSTM was selected only because the predeclared MAE rule gave it the lowest full-precision validation MAE. It should not be interpreted as generally superior to CNN or Transformer.

After selection, a fresh LSTM was trained on the 93 training and validation patients for the selected seven epochs. Test patients were evaluated once.

Final held-out test results

MethodMAE (mg/dL)RMSE (mg/dL)R²
Persistence11.400216.90580.8804
Linear Regression9.264413.16250.9274
Delta Random Forest8.882112.81760.9311
LSTM8.750212.61200.9335

The LSTM reduced MAE by 23.25% relative to persistence. The classical and sequence pipelines differ by 18 valid test examples, so their cross-pipeline comparison is close but not perfectly row-identical.

Performance by cohort

CohortExamplesMAERMSER²
T1DM2,0609.748913.56990.9481
T2DM14,9328.612512.47410.9303

Performance by actual glucose range

RangeExamplesMAERMSER²
Below 705206.29788.4891-0.2715
70 to 18013,5317.920811.34240.8476
Above 1802,94113.000017.73050.7104

Negative R² in the below-70 subgroup occurs partly because the subgroup has a narrow target range; it does not mean that subgroup has the largest MAE.

Usage

Create an environment and install the small inference requirements:

pip install -r requirements.txt
python inference.py example_input.json

Python usage:

import json
from inference import load_model, predict_future_glucose

model, normalization = load_model("model.pt")
document = json.load(open("example_input.json", encoding="utf-8"))
result = predict_future_glucose(model, normalization, document)
print(result)

Intended use

  • Educational machine-learning demonstrations
  • Reproducible research experiments
  • Retrospective CGM forecasting exploration
  • Non-clinical prototypes with human review

Limitations and prohibited uses

  • Not a medical device.
  • Not for diagnosis, treatment, emergency detection, or insulin dosing.
  • Do not use a forecast to change medication, food, or exercise decisions.
  • The source data is from a limited Chinese clinical cohort and may not generalize to Iraqi patients, other countries, other CGM devices, children, pregnancy, or different care settings.
  • T1DM is substantially underrepresented relative to T2DM.
  • Meals, insulin timing, exercise, stress, sleep, illness, and medication events are not direct inputs.
  • Performance is weakest above 180 mg/dL.
  • The model requires a complete 24-hour sequence sampled every 15 minutes.
  • A low average error does not guarantee safety for an individual prediction.

Reproducibility

  • Python: 3.11.9
  • PyTorch: 2.15.0 CPU
  • Random seed: 42
  • Batch size: 512
  • Learning rate: 0.001
  • Weight decay: 0.0001
  • Final epochs after selection: 7

Normalization statistics and the complete state dictionary are stored inside model.pt. metadata.json contains machine-readable training and evaluation information.

License and attribution

The repository is released under CC BY 4.0. Cite this model repository and the Shanghai dataset DOI when reusing the model or results.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

Прогнозирование временных рядов пока не поддерживается рантаймом.

Ревизия весов
da4dff1

0 моделей