tempor.metrics.time_to_event.plugin_builtin_time_to_event module¶
Module with built-in metric plugins for the time-to-event (survival) analysis task.
- class tempor.metrics.time_to_event.plugin_builtin_time_to_event.CIndexTimeToEventMetric[source]¶
Bases:
TimeToEventMetricIPCW concordance index metric for time-to-event (survival) analysis tasks.
The base class that all plugins must inherit from.
- evaluate(actual: tuple[ndarray, ndarray], predicted: ndarray, horizons: list[float] | list[int] | list[Timestamp], actual_train: tuple[ndarray, ndarray], *args: Any, **kwargs: Any) list[float][source]¶
The metric evaluation call.
- Parameters:¶
- actual : metric_typing.EventArrayTimeArray¶
A tuple of two numpy arrays: the event values array and the event times array, for the actual event vales.
- predicted : np.ndarray¶
A numpy array of shape
(n_samples, n_horizons_timesteps, n_features)with the predicted risk estimates.- horizons : data_typing.TimeIndex¶
List of horizons time points.
- actual_train : metric_typing.EventArrayTimeArray¶
A tuple of two numpy arrays: the event values array and the event times array, for the actual event vales - in the training set.
- *args : Any
Additional positional arguments.
- **kwargs : Any
Additional keyword arguments.
- Returns:¶
The metric values for each horizon time point.
- Return type:¶
List[float]
-
category : ClassVar[str] =
'time_to_event'¶ Plugin category, such as
'prediction.one_off.classification'. Must be set by the plugin class using@register_plugin.
- class tempor.metrics.time_to_event.plugin_builtin_time_to_event.BrierScoreTimeToEventMetric[source]¶
Bases:
TimeToEventMetricTime-dependent Brier score metric for time-to-event (survival) analysis tasks.
The base class that all plugins must inherit from.
- evaluate(actual: tuple[ndarray, ndarray], predicted: ndarray, horizons: list[float] | list[int] | list[Timestamp], actual_train: tuple[ndarray, ndarray], *args: Any, **kwargs: Any) list[float][source]¶
The metric evaluation call.
- Parameters:¶
- actual : metric_typing.EventArrayTimeArray¶
A tuple of two numpy arrays: the event values array and the event times array, for the actual event vales.
- predicted : np.ndarray¶
A numpy array of shape
(n_samples, n_horizons_timesteps, n_features)with the predicted risk estimates.- horizons : data_typing.TimeIndex¶
List of horizons time points.
- actual_train : metric_typing.EventArrayTimeArray¶
A tuple of two numpy arrays: the event values array and the event times array, for the actual event vales - in the training set.
- *args : Any
Additional positional arguments.
- **kwargs : Any
Additional keyword arguments.
- Returns:¶
The metric values for each horizon time point.
- Return type:¶
List[float]
-
category : ClassVar[str] =
'time_to_event'¶ Plugin category, such as
'prediction.one_off.classification'. Must be set by the plugin class using@register_plugin.