sparsesurv.loss module
Summary
Functions:
Negative log-likelihood function for accelerated failure time model. |
|
Negative log-likelihood function for accelerated failure time model when the design matrix |
|
Negative log-likelihood function with Breslow tie-correction. |
|
Negative log-likelihood function with Efron tie-correction. |
|
Negative log-likelihood function with Efron tie-correction when the design matrix |
|
Negative log-likelihood function for extended hazards model. |
|
Negative log-likelihood function for extended hazards model when the design matrix |
Reference
- breslow_negative_likelihood(linear_predictor, time, event)[source]
Negative log-likelihood function with Breslow tie-correction.
- Parameters:
linear_predictor (npt.NDArray[np.float64]) – Linear predictor of the training data.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
- Raises:
RuntimeError – Raises runtime error when there are no deaths/events in the given batch of samples.
- Returns:
Average negative log likelihood.
- Return type:
npt.NDArray[np.float64]
- efron_negative_likelihood(linear_predictor, time, event)[source]
Negative log-likelihood function with Efron tie-correction.
- Parameters:
linear_predictor (npt.NDArray[np.float64]) – Linear predictor of the training data.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
- Raises:
RuntimeError – Raises runtime error when there are no deaths/events in the given batch of samples.
- Returns:
Average negative log likelihood.
- Return type:
npt.NDArray[np.float64]
- efron_negative_likelihood_beta(beta, X, time, event)[source]
- Negative log-likelihood function with Efron tie-correction when the design matrix
and the coefficients beta are provided instead of the linear predictor directly.
- Parameters:
beta (npt.NDArray[np.float64]) – Coefficient vector of length p.
X (npt.NDArray[np.float64]) – Design matrix of the training data. N rows and p columns.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
- Returns:
Average negative log likelihood.
- Return type:
npt.NDArray[np.float64]
- aft_negative_likelihood(linear_predictor, time, event, bandwidth=None)[source]
Negative log-likelihood function for accelerated failure time model.
- Parameters:
linear_predictor (npt.NDArray[np.float64]) – Linear predictor of the training data.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
bandwidth (float, optional) – Bandwidth to kernel-smooth the profile likelihood. Will be estimated empirically if not specified. Defaults to None.
- Raises:
RuntimeError – Raises runtime error when there are no deaths/events in the given batch of samples.
- Returns:
Average negative log-likelihood.
- Return type:
npt.NDArray[np.float64]
- aft_negative_likelihood_beta(beta, X, time, event, bandwidth=None)[source]
- Negative log-likelihood function for accelerated failure time model when the design matrix
and the coefficients beta are provided instead of the linear predictor directly.
- Parameters:
beta (npt.NDArray[np.float64]) – Coefficient vector of length p.
X (npt.NDArray[np.float64]) – Design matrix of the training data. N rows and p columns.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
bandwidth (float, optional) – Bandwidth to kernel-smooth the profile likelihood. Will be estimated empirically if not specified. Defaults to None.
- Returns:
Average negative log-likelihood.
- Return type:
npt.NDArray[np.float64]
- eh_negative_likelihood(linear_predictor, time, event, bandwidth=None)[source]
Negative log-likelihood function for extended hazards model.
- Parameters:
linear_predictor (npt.NDArray[np.float64]) – Linear predictor of the training data.
time (npt.NDArray[np.float64]) – Time points of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
bandwidth (float, optional) – Bandwidth to kernel-smooth the profile likelihood. Will be estimated empirically if not specified. Defaults to None.
- Raises:
RuntimeError – Raises runtime error when there are no deaths/events in the given batch of samples.
- Returns:
Average negative log-likelihood.
- Return type:
npt.NDArray[np.float64]
- eh_negative_likelihood_beta(beta, X, time, event, bandwidth=None)[source]
- Negative log-likelihood function for extended hazards model when the design matrix
and the coefficients beta are provided instead of the linear predictor directly.
- Parameters:
beta (npt.NDArray[np.float64]) – Coefficient vector of length p.
X (npt.NDArray[np.float64]) – Design matrix of the training data. N rows and p columns.
time (npt.NDArray[np.float64]) – Time of the training data of length n. Assumed to be sorted.
event (npt.NDArray[np.float64]) – Event indicator of the training data of length n.
bandwidth (float, optional) – Bandwidth to kernel-smooth the profile likelihood. Will be estimated empirically if not specified. Defaults to None.
- Returns:
Average negative log-likelihood.
- Return type:
npt.NDArray[np.float64]