Tabular Classification
Scikit-learn
English
healthcare
ehr
copd
clinical-risk
tabular
scikit-learn
xgboost
lightgbm
Instructions to use stormid/copd-model-c with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use stormid/copd-model-c with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("stormid/copd-model-c", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
| """Unit tests for the remove_data_between_exacerbations function.""" | |
| import copd | |
| import numpy as np | |
| import pandas as pd | |
| import pytest | |
| def input_df(): | |
| """Sample input data including an exacerbation flagged for removal.""" | |
| return pd.DataFrame({'Date': pd.date_range('2022-01-01', '2022-01-10'), | |
| 'IsExac': [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], | |
| 'DaysSinceLastExac': [-1, -1, 1, 2, 3, 4, 5, 1, 2, 1], | |
| 'RemoveExac': [0, 0, 0, 0, 0, 0, 1, 0, 0, 0]}) | |
| def expected_df(): | |
| """Define expected output dataframe.""" | |
| return pd.DataFrame({'Date': pd.date_range('2022-01-01', '2022-01-10'), | |
| 'IsExac': [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], | |
| 'DaysSinceLastExac': [-1, -1, 1, 2, 3, 4, 5, 1, 2, 1], | |
| 'RemoveExac': [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], | |
| 'RemoveRow': [np.nan, np.nan, 1, 1, 1, 1, 1, np.nan, | |
| np.nan, np.nan]}) | |
| def test_output_equals_expected(input_df, expected_df): | |
| """Test output is as expected.""" | |
| output_df = copd.remove_data_between_exacerbations(input_df) | |
| pd.testing.assert_frame_equal(output_df, expected_df) | |