Beispiel #1
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
Beispiel #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 : `ModelQuadraticHinge`
            The current instance with given data
        """
        ModelFirstOrder.fit(self, features, labels)
        ModelGeneralizedLinear.fit(self, features, labels)
        ModelLipschitz.fit(self, features, labels)
        self._set(
            "_model",
            _ModelModelQuadraticHinge(self.features, self.labels,
                                      self.fit_intercept, self.n_threads))
        return self
Beispiel #3
0
 def __init__(self, fit_intercept: bool = True, n_threads: int = 1):
     ModelFirstOrder.__init__(self)
     ModelGeneralizedLinearWithIntercepts.__init__(self,
                                                   fit_intercept)
     ModelLipschitz.__init__(self)
     self.n_threads = n_threads