Classical machine learning models¶
Wrappers around scikit-learn, LightGBM, XGBoost, CatBoost and imbalanced-learn estimators.
icu_benchmarks.models.ml_models.sklearn
¶
icu_benchmarks.models.ml_models.lgbm
¶
Classes:
| Name | Description |
|---|---|
LGBMWrapper |
|
LGBMClassifier |
|
LGBMWrapper
¶
Bases: MLWrapper
Methods:
| Name | Description |
|---|---|
fit_model |
Fitting function for LGBM models. |
Source code in icu_benchmarks/models/wrappers.py
fit_model
¶
Fitting function for LGBM models.
Source code in icu_benchmarks/models/ml_models/lgbm.py
LGBMClassifier
¶
LGBMClassifier(*args, verbosity: int = -1, **kwargs)
Bases: LGBMWrapper
Methods:
| Name | Description |
|---|---|
predict |
Predicts class probabilities for the given features. |
Source code in icu_benchmarks/models/ml_models/lgbm.py
predict
¶
Predicts class probabilities for the given features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Input features for prediction. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Predicted probabilities for each class. |
Source code in icu_benchmarks/models/ml_models/lgbm.py
icu_benchmarks.models.ml_models.xgboost
¶
Classes:
| Name | Description |
|---|---|
XGBClassifier |
|
XGBClassifier
¶
Bases: MLWrapper
Methods:
| Name | Description |
|---|---|
resolve_device |
Returns the XGBoost device; "auto" picks CUDA when available, and the --cpu flag always forces the CPU. |
predict |
Predicts class probabilities for the given features. |
fit_model |
Fit the model to the training data (default SKlearn syntax) |
set_model_args |
Pass every argument except the wrapper's own to XGBoost, which takes its hyperparameters as **kwargs. |
Source code in icu_benchmarks/models/ml_models/xgboost.py
resolve_device
staticmethod
¶
Returns the XGBoost device; "auto" picks CUDA when available, and the --cpu flag always forces the CPU.
Source code in icu_benchmarks/models/ml_models/xgboost.py
predict
¶
Predicts class probabilities for the given features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Input features for prediction. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Predicted probabilities for each class. |
Source code in icu_benchmarks/models/ml_models/xgboost.py
fit_model
¶
Fit the model to the training data (default SKlearn syntax)
Source code in icu_benchmarks/models/ml_models/xgboost.py
set_model_args
¶
Pass every argument except the wrapper's own to XGBoost, which takes its hyperparameters as **kwargs.
Booster-specific parameters (such as DART's rate_drop) are not in get_params(), so filtering against it would drop them. XGBoost warns about parameters it does not use.
Source code in icu_benchmarks/models/ml_models/xgboost.py
icu_benchmarks.models.ml_models.catboost
¶
Classes:
| Name | Description |
|---|---|
CBClassifier |
|
CBClassifier
¶
Bases: MLWrapper
Methods:
| Name | Description |
|---|---|
predict |
Predicts class probabilities for the given features. |
Source code in icu_benchmarks/models/ml_models/catboost.py
predict
¶
Predicts class probabilities for the given features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Input features for prediction. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Predicted probabilities for each class. |