logml.survival_analysis.extractors.cox
Classes
|
Runs Cox (backward + forward paths) analysis, saves the result model. |
- class logml.survival_analysis.extractors.cox.CoxSAParams
Bases:
pydantic.main.BaseModel
Defines hyperparams for Cox BF method.
Show JSON schema
{ "title": "CoxSAParams", "description": "Defines hyperparams for Cox BF method.", "type": "object", "properties": { "cox_model_penalizer": { "title": "Cox Model Penalizer", "description": "Defines a penalizer for CoxPHFitter model (lifelines package). Helps to avoid issues while fitting due to multicollinearity.", "default": 0.01, "type": "number" }, "normalize_numericals": { "title": "Normalize Numericals", "description": "Whether numerical values should be normalized before fitting Cox model. Otherwise numerical values are to be binarized using thresholds found either via KaplanMeier or OptimalCutOff methods.", "default": false, "type": "boolean" }, "univariate_p_value_threshold": { "title": "Univariate P Value Threshold", "description": "Defines a threshold that is used to select features for Cox Backward-Forward method from the summary table produced by OptimalCutOff method (applied to FDR corrected p-values).", "default": 0.05, "type": "number" }, "covariate_p_value_threshold": { "title": "Covariate P Value Threshold", "description": "Defines a threshold that is used to check feature significance based on Cox model summary.", "default": 0.05, "type": "number" }, "backward_path_single_removal_threshold": { "title": "Backward Path Single Removal Threshold", "default": 150, "type": "integer" }, "backward_path_batch_size": { "title": "Backward Path Batch Size", "default": 30, "type": "integer" }, "backward_path_batch_p_value": { "title": "Backward Path Batch P Value", "default": 0.7, "type": "number" } } }
- Fields
- field cox_model_penalizer: float = 0.01
Defines a penalizer for CoxPHFitter model (lifelines package). Helps to avoid issues while fitting due to multicollinearity.
- field normalize_numericals: bool = False
Whether numerical values should be normalized before fitting Cox model. Otherwise numerical values are to be binarized using thresholds found either via KaplanMeier or OptimalCutOff methods.
- field univariate_p_value_threshold: float = 0.05
Defines a threshold that is used to select features for Cox Backward-Forward method from the summary table produced by OptimalCutOff method (applied to FDR corrected p-values).
- field covariate_p_value_threshold: float = 0.05
Defines a threshold that is used to check feature significance based on Cox model summary.
- field backward_path_single_removal_threshold: int = 150
- field backward_path_batch_size: int = 30
- field backward_path_batch_p_value: float = 0.7
- class logml.survival_analysis.extractors.cox.CoxSAExtractor(cfg: GlobalConfig, sa_setup: SurvivalAnalysisSetup, global_params: dict, logger=None)
Bases:
logml.survival_analysis.extractors.base.BaseSAExtractor
Runs Cox (backward + forward paths) analysis, saves the result model.
- LABEL = 'cox'
- CONFIG_CLASS
- run()
Three-step workflow:
select initial features for Cox - all significant features
(based on univariate analysis) - backward path - sequentially removing features until we get significant model (all features are significant) - forward path - trying to add removed features back