-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update simulation utils for survival
- Loading branch information
1 parent
9215c5f
commit 1f9a083
Showing
4 changed files
with
102 additions
and
19 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
feature_importance/fi_config/mdi_plus_survival/test/dgp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import sys | ||
sys.path.append("../..") | ||
from feature_importance.scripts.simulations_util import * | ||
|
||
import sksurv | ||
from sksurv import datasets | ||
|
||
|
||
X_DGP = load_X_data | ||
X_PARAMS_DICT = { | ||
"data_fn": sksurv.datasets.load_aids | ||
} | ||
Y_DGP = load_y_data | ||
Y_PARAMS_DICT = { | ||
"data_fn": sksurv.datasets.load_aids | ||
} | ||
|
||
VARY_PARAM_NAME = None | ||
VARY_PARAM_VALS = None | ||
# VARY_PARAM_NAME = ["corrupt_size", "sample_row_n"] | ||
# VARY_PARAM_VALS = {"corrupt_size": {"0": 0, "0.01": 0.005, "0.025": 0.0125, "0.05": 0.025}, | ||
# "sample_row_n": {"100": 100, "250": 250, "472": 472}} |
31 changes: 31 additions & 0 deletions
31
feature_importance/fi_config/mdi_plus_survival/test/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import copy | ||
from feature_importance.util import ModelConfig, FIModelConfig | ||
from feature_importance.scripts.competing_methods import tree_mdi_plus, tree_mdi, tree_mdi_OOB, tree_mda, tree_shap | ||
from sksurv.ensemble import RandomSurvivalForest | ||
|
||
from imodels.importance.rf_plus import RandomForestPlusSurvival | ||
from imodels.importance.ppms import CoxnetSurvivalPPM | ||
|
||
|
||
|
||
rf_model = RandomSurvivalForest(n_estimators=100, min_samples_leaf=5, max_features=0.33, random_state=42) | ||
ppm_model = CoxnetSurvivalPPM() | ||
ESTIMATORS = [ | ||
# [ModelConfig('RSF', RandomSurvivalForest, model_type='rsf', | ||
# other_params={'n_estimators': 100, 'min_samples_leaf': 5, 'max_features': 0.33, 'random_state': 27})], | ||
[ModelConfig('RSF+', RandomForestPlusSurvival, model_type='rsf+', | ||
other_params={'rf_model': copy.deepcopy(rf_model), | ||
'prediction_model': copy.deepcopy(ppm_model)})], | ||
] | ||
|
||
FI_ESTIMATORS = [ | ||
[FIModelConfig('MDI+', tree_mdi_plus, model_type='rsf+', splitting_strategy='train-test', | ||
other_params={'refit': False, 'sample_split': None, | ||
'mdiplus_kwargs': {'sample_split': None}})], | ||
# [FIModelConfig('MDI+_ridge_loo_mae', tree_mdi_plus, model_type='tree', ascending=False, other_params={'scoring_fns': mean_absolute_error})], | ||
# [FIModelConfig('MDI+_Huber_loo_huber_loss', tree_mdi_plus, model_type='tree', ascending=False, other_params={'prediction_model': RobustRegressorPPM(), 'scoring_fns': huber_loss})], | ||
# [FIModelConfig('MDI', tree_mdi, model_type='tree')], | ||
# [FIModelConfig('MDI-oob', tree_mdi_OOB, model_type='tree')], | ||
# [FIModelConfig('MDA', tree_mda, model_type='tree')], | ||
# [FIModelConfig('TreeSHAP', tree_shap, model_type='tree')] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters