Exemplo n.º 1
0
    def fit(self, features, labels, censoring=None):
        """Set the data into the model object.

        Parameters
        ----------
        features : List[{2d array, csr matrix containing float64
            of shape (n_intervals, n_features)}]
            The features matrix

        labels : List[{1d array, csr matrix of shape (n_intervals,)]
            The labels vector

        censoring : 1d array of shape (n_cases,)
            The censoring vector

        Returns
        -------
        output : `ModelSCCS`
            The current instance with given data
        """
        ModelFirstOrder.fit(self, features, labels, censoring)
        ModelLipschitz.fit(self, features, labels)

        self._set(
            "_model",
            _ModelSCCS(features=self.features,
                       labels=self.labels,
                       censoring=self.censoring,
                       n_lags=self.n_lags))

        self.dtype = features[0].dtype
        return self
Exemplo n.º 2
0
    def fit(self, features, labels):
        """Set the data into the model object

        Parameters
        ----------
        features : {`numpy.ndarray`, `scipy.sparse.csr_matrix`}, shape=(n_samples, n_features)
            The features matrix, either dense or sparse

        labels : `numpy.ndarray`, shape=(n_samples,)
            The labels vector

        Returns
        -------
        output : `ModelHuber`
            The current instance with given data
        """
        ModelFirstOrder.fit(self, features, labels)
        ModelGeneralizedLinear.fit(self, features, labels)
        ModelLipschitz.fit(self, features, labels)
        self._set("_model", _ModelHuber(self.features,
                                        self.labels,
                                        self.fit_intercept,
                                        self.threshold,
                                        self.n_threads))
        return self
Exemplo n.º 3
0
    def fit(self, features, labels):
        """Set the data into the model object

        Parameters
        ----------
        features : {`numpy.ndarray`, `scipy.sparse.csr_matrix`}, shape=(n_samples, n_features)
            The features matrix, either dense or sparse

        labels : `numpy.ndarray`, shape=(n_samples,)
            The labels vector

        Returns
        -------
        output : `ModelPoisReg`
            The current instance with given data
        """
        ModelFirstOrder.fit(self, features, labels)
        ModelGeneralizedLinear.fit(self, features, labels)

        self._set("_model", self._build_cpp_model(features.dtype))
        return self
Exemplo n.º 4
0
    def fit(self, features, labels):
        """Set the data into the model object

        Parameters
        ----------
        features : `numpy.ndarray`, shape=(n_samples, n_features)
            The features matrix

        labels : `numpy.ndarray`, shape=(n_samples,)
            The labels vector

        Returns
        -------
        output : `ModelLinRegWithIntercepts`
            The current instance with given data
        """
        ModelFirstOrder.fit(self, features, labels)
        ModelGeneralizedLinearWithIntercepts.fit(self, features, labels)
        ModelLipschitz.fit(self, features, labels)
        self._set("_model", _ModelLinRegWithIntercepts(self.features,
                                                       self.labels,
                                                       self.fit_intercept,
                                                       self.n_threads))
        return self