A machine-learning framework for predicting outcomes from time-series history.
Forcast outcomes from time-series history. This is the top-performing algorithm for DII National Data Science Challenge.
Install this package via pip:
pip install timesias
or clone this program to your local directory:
git clone https://github.com/GuanLab/timesias.git
Input data format
The example data in the data/ are randomly generated data for the demonstration of the algorithm.
Two types of data is requied for model training and prediction:
gs.file: gold standard file with two columns. The first column is paths for time-series records. The second column is the gold standard (0/1), representing the final outbreak of sepsis
./data/0.psv,1 ./data/1.psv,1 ./data/2.psv,0 ./data/3.psv,1 ./data/4.psv,0 ./data/5.psv,1 ./data/6.psv,1
*.psv: time series record files.
.psvtable files separated by
|, which are the time-series records. The header of psv file are the feature names. To note, the first column is the time index.
HR|feature_1|feature_2|...|feature_n-1|feature_n 0.0|1|0.0|...|1.3|0.0 1.0|NaN|0.0|...|0.0|0.0 3.5|NaN|2.3|...|0.0|0.0
Model training and cross validation
timesias -g [GS_FILE_PATH] -t [LAST_N_RECORDS] -f [EXTRA_FEATURES] -e [EVA_METRICS] --shap
GS_FILE_PATH: the path to the gold-standard file; for example,
LAST_N_RECORDS: last n records to use for prediction. default: 16;
EXTRA_FEATURES: addtional features used for prediction. default: ['norm', 'std', 'missing_portion', 'baseline'], which are all features we used in DII Data challenge.
EVA_METRICS: evaluation metrics to use. Available choices: auroc auprc cindex pearsonr spearmanr. For binary classification,
AUPRCare recommended; for regression, we recommend:
Spearmanr. default: AUROC AUPRC
to get instructions on the usage of our program.
The above one-line command will yield the following results automatically:
./models.: where all hyperparameters of trained models will be saved.
./results: where all results mentioned below will be stored:
eva.tsv: Evaluation results during five-fold cross validation.
- all results from top feature evaluations if
--shapis used. the details will be mentioned in the next section.
Top feature evaluation
--shap is indicated, SHAP analysis will be carried out to show top contributing measurements and last nth time points. This will generate an html report (
./results/top_feature_report.html) like the following:
The corresponding shap values will be stored in
Other applications of this method
This method can be generalized to be used on other hospitalization data. One application of this method is the COVID-19 DREAM Challenge, where this method also achieves top performance.
- For citation, please refer to our latest iScience paper: Assessment of the timeliness and robustness for predicting adult sepsis.
- For protocol(TBD)
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.