MICE + ARIMA + XGBoost to handle missing values of CGM device
Project description
CGMissingData
CGMissingData is a simple missing-data benchmarking package that runs:
MICE imputation (IterativeImputer)
ARIMA
XGBoost
Your CSV must include at least these columns:
Glucose value (target) = glucose_col
TimeSeries — time series data
Timestamp data= timestamp_col
subject ID = subjectid
How to Run?
- Envirionment Setup- cd "C:\Path\To\Your\Project"
Create a virtual environment python -m venv .venv
Activate the environment ..venv\Scripts\activate
-
Install python python -m pip install --upgrade pip pip install -e .
-
..venv\Scripts\python.exe -c "from CGMmissingData import run_missingness_benchmark; r=run_missingness_benchmark('MyData.csv', mask_rates=[0.05, 0.10, 0.20, 0.30, 0.40]); print(r); r.to_csv('results.csv', index=False)" #Ensure your dataset (e.g., MyData.csv) is located in the project file. Execute the benchmark directly from the CLI to generate a results.csv file:
Using Google Colab?
-
!pip -q install CGMissingData==0.1.2 (change the version number depending our new release. You can also try with !pip -q install CGMissingData)
-
from CGMissingData import run_missingness_benchmark
-
df = "/content/drive/MyDrive/CGMExampleData.csv" # your dataset path
-
results = run_missingness_benchmark( "CGMExampleData.csv", # or df mask_rates=[0.05, 0.10, 0.20, 0.30, 0.40] )
-
print(results)
-
results.to_csv("results.csv", index=False)
cgmmissing
CGM missing value imputation pipeline:
- Convert
timestampto a numeric equal-intervalTimeSeriesusingCGManalyzer::equalInterval.fnviarpy2 - Add lag features per
subjectid:lag1,lag2,lag3,rollmean - Compute missing rate on
glucose_value - If missing rate <= 5%: MICE + ARIMA (segmentwise over missing blocks) Else: MICE + XGBoost
- Output original dataset plus
imputed_glucose_value
Install
pip install -e .
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cgmissingdata-0.1.6.tar.gz.
File metadata
- Download URL: cgmissingdata-0.1.6.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4c7b35135a0103c4449d540480a21077489ca609050288f1f51c19df2341533
|
|
| MD5 |
86ddac858ae504119ff7a044252b9f14
|
|
| BLAKE2b-256 |
782e5ab52c2370bef50c19379184eac070cb32082a8b36b768a5a8615379c6aa
|