def __init__(self, fit_intercept: bool = True, threshold: float = 1, n_threads: int = 1): ModelFirstOrder.__init__(self) ModelGeneralizedLinear.__init__(self, fit_intercept) ModelLipschitz.__init__(self) self.n_threads = n_threads self.threshold = threshold
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
def __init__(self, fit_intercept: bool = True, smoothness: float = 1., n_threads: int = 1): ModelFirstOrder.__init__(self) ModelGeneralizedLinear.__init__(self, fit_intercept) ModelLipschitz.__init__(self) self.n_threads = n_threads self.smoothness = smoothness
def __init__(self, fit_intercept: bool = True, link: str = "exponential", n_threads: int = 1): ModelSecondOrder.__init__(self) ModelGeneralizedLinear.__init__(self, fit_intercept) ModelSelfConcordant.__init__(self) self._set("_link", None) self.link = link self.n_threads = n_threads
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
def set_model(self, model: ModelGeneralizedLinear): """Set model in the solver Parameters ---------- model : `ModelGeneralizedLinear` Sets the model in the solver. The model gives the first order information about the model (loss, gradient, among other things). SAGA only accepts childs of `ModelGeneralizedLinear` Returns ------- output : `Solver` The `Solver` with given model """ if not isinstance(model, ModelGeneralizedLinear): raise ValueError("SAGA accepts only childs of " "`ModelGeneralizedLinear`") if hasattr(model, "n_threads"): model.n_threads = self.n_threads return SolverFirstOrderSto.set_model(self, model)
def __init__(self, fit_intercept: bool = True, n_threads: int = 1): ModelFirstOrder.__init__(self) ModelGeneralizedLinear.__init__(self, fit_intercept) self.n_threads = n_threads
def __init__(self, fit_intercept: bool = True): ModelGeneralizedLinear.__init__(self, fit_intercept)