Skip to main content

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?

  1. Envirionment Setup- cd "C:\Path\To\Your\Project"

Create a virtual environment python -m venv .venv

Activate the environment ..venv\Scripts\activate

  1. Install python python -m pip install --upgrade pip pip install -e .

  2. ..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?

  1. !pip -q install CGMissingData==0.1.2 (change the version number depending our new release. You can also try with !pip -q install CGMissingData)

  2. from CGMissingData import run_missingness_benchmark

  3. df = "/content/drive/MyDrive/CGMExampleData.csv" # your dataset path

  4. results = run_missingness_benchmark( "CGMExampleData.csv", # or df mask_rates=[0.05, 0.10, 0.20, 0.30, 0.40] )

  5. print(results)

  6. results.to_csv("results.csv", index=False)

cgmmissing

CGM missing value imputation pipeline:

  1. Convert timestamp to a numeric equal-interval TimeSeries using CGManalyzer::equalInterval.fn via rpy2
  2. Add lag features per subjectid: lag1, lag2, lag3, rollmean
  3. Compute missing rate on glucose_value
  4. If missing rate <= 5%: MICE + ARIMA (segmentwise over missing blocks) Else: MICE + XGBoost
  5. 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

cgmissingdata-0.1.7.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cgmissingdata-0.1.7-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file cgmissingdata-0.1.7.tar.gz.

File metadata

  • Download URL: cgmissingdata-0.1.7.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for cgmissingdata-0.1.7.tar.gz
Algorithm Hash digest
SHA256 2edc91c4cf1d6db1220e0446f1997445ca02c16dd9678ccdf6d98c0d0f0bcedf
MD5 11d2dfd994fb4d554a7122873c9e885d
BLAKE2b-256 80f4a30fd00b0252c80027f38dc12802f01e24e8bbddc2283c345d2be4d53641

See more details on using hashes here.

File details

Details for the file cgmissingdata-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: cgmissingdata-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for cgmissingdata-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3f819ec3226841d2268ff02e3b53a253bca0edc4463d24c56af9a711b7803aa5
MD5 96481ca7357752896c54aa8667719c61
BLAKE2b-256 caf8dcd5dfe7b6cd2f9cbcf37493bfcfe561fc2a89029934188459c06e8d41a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page