# 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/exceptions.py
# class NoComparablePairException(ValueError):
#     """An error indicating that data of censored event times
#     does not contain one or more comparable pairs.
#     """
# 
# 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 itertools
import numpy
import pandas
from scipy.special import comb
from sklearn.svm import LinearSVC
from sklearn.utils import check_random_state
from sklearn.utils.validation import _get_feature_names
from ..base import SurvivalAnalysisMixin
from ..exceptions import NoComparablePairException
from ..util import check_array_survival
    sksurv.svm.FastSurvivalSVM
        Alternative implementation with reduced time complexity for training.

    References
    ----------
    .. [1] Van Belle, V., Pelckmans, K., Suykens, J. A., & Van Huffel, S.
           Support Vector Machines for Survival Analysis. In Proc. of the 3rd Int. Conf.
           on Computational Intelligence in Medicine and Healthcare (CIMED). 1-8. 2007

    .. [2] Evers, L., Messow, C.M.,
           "Sparse kernel methods for high-dimensional survival data",
           Bioinformatics 24(14), 1632-8, 2008.

    """
    def __init__(self, penalty='l2', loss='squared_hinge', dual=False, tol=1e-4,
                 alpha=1.0, verbose=0, random_state=None, max_iter=1000):
        super().__init__(penalty=penalty,
                         loss=loss,
                         dual=dual,
                         tol=tol,
                         verbose=verbose,
                         random_state=random_state,
                         max_iter=max_iter,
                         fit_intercept=False)
        self.alpha = alpha

    def _get_survival_pairs(self, X, y, random_state):  # pylint: disable=no-self-use
        feature_names = _get_feature_names(X)

        X = self._validate_data(X, ensure_min_samples=2)

# 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/exceptions.py
# class NoComparablePairException(ValueError):
#     """An error indicating that data of censored event times
#     does not contain one or more comparable pairs.
#     """
# 
# 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/svm/naive_survival_svm.py
import itertools
import numpy
import pandas
from scipy.special import comb
from sklearn.svm import LinearSVC
from sklearn.utils import check_random_state
from sklearn.utils.validation import _get_feature_names
from ..base import SurvivalAnalysisMixin
from ..exceptions import NoComparablePairException
from ..util import check_array_survival

    sksurv.svm.FastSurvivalSVM
        Alternative implementation with reduced time complexity for training.

    References
    ----------
    .. [1] Van Belle, V., Pelckmans, K., Suykens, J. A., & Van Huffel, S.
           Support Vector Machines for Survival Analysis. In Proc. of the 3rd Int. Conf.
           on Computational Intelligence in Medicine and Healthcare (CIMED). 1-8. 2007

    .. [2] Evers, L., Messow, C.M.,
           "Sparse kernel methods for high-dimensional survival data",
           Bioinformatics 24(14), 1632-8, 2008.

    """
    def __init__(self, penalty='l2', loss='squared_hinge', dual=False, tol=1e-4,
                 alpha=1.0, verbose=0, random_state=None, max_iter=1000):
        super().__init__(penalty=penalty,
                         loss=loss,
                         dual=dual,
                         tol=tol,
                         verbose=verbose,
                         random_state=random_state,
                         max_iter=max_iter,
                         fit_intercept=False)
        self.alpha = alpha

    def _get_survival_pairs(self, X, y, random_state):  # pylint: disable=no-self-use
        feature_names = _get_feature_names(X)

        X = self._validate_data(X, ensure_min_samples=2)

        event, time = check_array_survival(X, y)