tempor.methods.time_to_event package

Submodules

Module contents

Time-to-event (survival) analysis methods.

class tempor.methods.time_to_event.BaseTimeToEventAnalysis(**params: Any)[source]

Bases: BasePredictor

Abstract base class for all predictors.

Defines some core methods, primarily: - predict: Predicts the target variable for the given data. - predict_proba: Predicts the probability of the target variable for the given data. - predict_counterfactuals: Predicts the counterfactuals for the given data. - The _ versions of the above methods are the implementations of the above methods in the derived classes.

fit(data: BaseDataset, *args: Any, **kwargs: Any) Self[source]

Fit the method to the data.

Parameters:
data : dataset.BaseDataset

The dataset to fit the model to.

*args : Any

Additional arguments to pass to the _fit method.

**kwargs : Any

Additional keyword arguments to pass to the _fit method.

Returns:

The fitted model.

Return type:

Self

predict(data: PredictiveDataset, horizons: list[float] | list[int] | list[Timestamp], *args, **kwargs) TimeSeriesSamplesBase[source]

Predict risk scores for the given data. Output is risk scores at time points, hence samples.TimeSeriesSamplesBase.

Parameters:
data : dataset.PredictiveDataset

Dataset to predict on. Should be dataset.TimeToEventAnalysisDataset.

horizons : data_typing.TimeIndex

Time points to predict at.

*args

Additional arguments.

**kwargs

Additional keyword arguments.

Returns:

Predicted risk scores at the given time points.

Return type:

samples.TimeSeriesSamplesBase

predict_proba(data: PredictiveDataset, *args: Any, **kwargs: Any) Any[source]

Not used for this case. Raises an error.