# Path: sksurv/base.py
# class SurvivalAnalysisMixin:
# 
#     def score(self, X, y):
#         """Returns the concordance index of the prediction.
# 
#         Parameters
#         ----------
#         X : array-like, shape = (n_samples, n_features)
#             Test samples.
# 
#         y : structured array, shape = (n_samples,)
#             A structured array containing the binary event indicator
#             as first field, and time of event or time of censoring as
#             second field.
# 
#         Returns
#         -------
#         cindex : float
#             Estimated concordance index.
#         """
#         from .metrics import concordance_index_censored
#         name_event, name_time = y.dtype.names
# 
#         risk_score = self.predict(X)
#         if not getattr(self, "_predict_risk_score", True):
#             risk_score *= -1  # convert prediction on time scale to risk scale
# 
#         result = concordance_index_censored(y[name_event], y[name_time], risk_score)
#         return result[0]
# 
# Path: sksurv/nonparametric.py
# def ipc_weights(event, time):
#     """Compute inverse probability of censoring weights
# 
#     Parameters
#     ----------
#     event : array, shape = (n_samples,)
#         Boolean event indicator.
# 
#     time : array, shape = (n_samples,)
#         Time when a subject experienced an event or was censored.
# 
#     Returns
#     -------
#     weights : array, shape = (n_samples,)
#         inverse probability of censoring weights
# 
#     See also
#     --------
#     CensoringDistributionEstimator
#         An estimator interface for estimating inverse probability
#         of censoring weights for unseen time points.
#     """
#     if event.all():
#         return numpy.ones(time.shape[0])
# 
#     unique_time, p = kaplan_meier_estimator(event, time, reverse=True)
# 
#     idx = numpy.searchsorted(unique_time, time[event])
#     Ghat = p[idx]
# 
#     assert (Ghat > 0).all()
# 
#     weights = numpy.zeros(time.shape[0])
#     weights[event] = 1.0 / Ghat
# 
#     return weights
# 
# Path: sksurv/util.py
# def check_array_survival(X, y):
#     """Check that all arrays have consistent first dimensions.
# 
#     Parameters
#     ----------
#     X : array-like
#         Data matrix containing feature vectors.
# 
#     y : structured array with two fields
#         A structured array containing the binary event indicator
#         as first field, and time of event or time of censoring as
#         second field.
# 
#     kwargs : dict
#         Additional arguments passed to :func:`sklearn.utils.check_array`.
# 
#     Returns
#     -------
#     event : array, shape=[n_samples,], dtype=bool
#         Binary event indicator.
# 
#     time : array, shape=[n_samples,], dtype=float
#         Time of event or censoring.
#     """
#     event, time = check_y_survival(y)
#     check_consistent_length(X, event, time)
#     return event, time


import numpy
from sklearn.linear_model import Ridge
from ..base import SurvivalAnalysisMixin
from ..nonparametric import ipc_weights
from ..util import check_array_survival
    """
    def __init__(self, alpha=1.0, fit_intercept=True, normalize="deprecated",
                 copy_X=True, max_iter=None, tol=1e-3, solver="auto"):
        super().__init__(alpha=alpha, fit_intercept=fit_intercept,
                         normalize=normalize, copy_X=copy_X,
                         max_iter=max_iter, tol=tol, solver=solver)

    @property
    def _predict_risk_score(self):
        return False

    def fit(self, X, y):
        """Build an accelerated failure time model.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_features)
            Data matrix.

        y : structured array, shape = (n_samples,)
            A structured array containing the binary event indicator
            as first field, and time of event or time of censoring as
            second field.

        Returns
        -------
        self
        """
        event, time = check_array_survival(X, y)


# Path: sksurv/base.py
# class SurvivalAnalysisMixin:
# 
#     def score(self, X, y):
#         """Returns the concordance index of the prediction.
# 
#         Parameters
#         ----------
#         X : array-like, shape = (n_samples, n_features)
#             Test samples.
# 
#         y : structured array, shape = (n_samples,)
#             A structured array containing the binary event indicator
#             as first field, and time of event or time of censoring as
#             second field.
# 
#         Returns
#         -------
#         cindex : float
#             Estimated concordance index.
#         """
#         from .metrics import concordance_index_censored
#         name_event, name_time = y.dtype.names
# 
#         risk_score = self.predict(X)
#         if not getattr(self, "_predict_risk_score", True):
#             risk_score *= -1  # convert prediction on time scale to risk scale
# 
#         result = concordance_index_censored(y[name_event], y[name_time], risk_score)
#         return result[0]
# 
# Path: sksurv/nonparametric.py
# def ipc_weights(event, time):
#     """Compute inverse probability of censoring weights
# 
#     Parameters
#     ----------
#     event : array, shape = (n_samples,)
#         Boolean event indicator.
# 
#     time : array, shape = (n_samples,)
#         Time when a subject experienced an event or was censored.
# 
#     Returns
#     -------
#     weights : array, shape = (n_samples,)
#         inverse probability of censoring weights
# 
#     See also
#     --------
#     CensoringDistributionEstimator
#         An estimator interface for estimating inverse probability
#         of censoring weights for unseen time points.
#     """
#     if event.all():
#         return numpy.ones(time.shape[0])
# 
#     unique_time, p = kaplan_meier_estimator(event, time, reverse=True)
# 
#     idx = numpy.searchsorted(unique_time, time[event])
#     Ghat = p[idx]
# 
#     assert (Ghat > 0).all()
# 
#     weights = numpy.zeros(time.shape[0])
#     weights[event] = 1.0 / Ghat
# 
#     return weights
# 
# Path: sksurv/util.py
# def check_array_survival(X, y):
#     """Check that all arrays have consistent first dimensions.
# 
#     Parameters
#     ----------
#     X : array-like
#         Data matrix containing feature vectors.
# 
#     y : structured array with two fields
#         A structured array containing the binary event indicator
#         as first field, and time of event or time of censoring as
#         second field.
# 
#     kwargs : dict
#         Additional arguments passed to :func:`sklearn.utils.check_array`.
# 
#     Returns
#     -------
#     event : array, shape=[n_samples,], dtype=bool
#         Binary event indicator.
# 
#     time : array, shape=[n_samples,], dtype=float
#         Time of event or censoring.
#     """
#     event, time = check_y_survival(y)
#     check_consistent_length(X, event, time)
#     return event, time


# Path: sksurv/linear_model/aft.py
import numpy
from sklearn.linear_model import Ridge
from ..base import SurvivalAnalysisMixin
from ..nonparametric import ipc_weights
from ..util import check_array_survival

    """
    def __init__(self, alpha=1.0, fit_intercept=True, normalize="deprecated",
                 copy_X=True, max_iter=None, tol=1e-3, solver="auto"):
        super().__init__(alpha=alpha, fit_intercept=fit_intercept,
                         normalize=normalize, copy_X=copy_X,
                         max_iter=max_iter, tol=tol, solver=solver)

    @property
    def _predict_risk_score(self):
        return False

    def fit(self, X, y):
        """Build an accelerated failure time model.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_features)
            Data matrix.

        y : structured array, shape = (n_samples,)
            A structured array containing the binary event indicator
            as first field, and time of event or time of censoring as
            second field.

        Returns
        -------
        self
        """
        event, time = check_array_survival(X, y)


        weights = ipc_weights(event, time)