MICE + Random Forest + KNN to handle missing values of CGM device
Project description
CGMissingData
CGMissingData is a simple missing-data benchmarking package that runs:
MICE imputation (IterativeImputer)
Random Forest regression
KNN regression
It helps you test model performance under different missing-value rates.
Your CSV must include at least these columns:
LBORRES — glucose value (target)
TimeSeries — time series data
TimeDifferenceMinutes — time difference in minutes
USUBJID — subject ID
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 .
-
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:
..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)"
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)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cgmissingdata-0.1.3.tar.gz.
File metadata
- Download URL: cgmissingdata-0.1.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70e3760144773f48a04958a886973145a39e4c6590885c0ed84965935c58b9e8
|
|
| MD5 |
8561627f5b806c9dfde16238564ea344
|
|
| BLAKE2b-256 |
d0a8048db2c07862ff5dcc9c45d69c04061da6eeb1c3037383870d60bfc8f50b
|
File details
Details for the file cgmissingdata-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cgmissingdata-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6880d4461ccf45e465a7615871404751f25113a75a097b9784ed22a6fb5b317d
|
|
| MD5 |
eb28a0b943c9a11458ef46632f6587ab
|
|
| BLAKE2b-256 |
fafffd2aeb1303ea0dc88ed7824ff6a9b79fa788340c5dc02f64e441eca42e89
|