package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `PoissonRegressor
]
type t = [ `BaseEstimator | `Object | `PoissonRegressor | `RegressorMixin ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val as_estimator : t -> [ `BaseEstimator ] Obj.t
val as_regressor : t -> [ `RegressorMixin ] Obj.t
val create : ?alpha:float -> ?fit_intercept:bool -> ?max_iter:int -> ?tol:float -> ?warm_start:bool -> ?verbose:int -> unit -> t

Generalized Linear Model with a Poisson distribution.

Read more in the :ref:`User Guide <Generalized_linear_regression>`.

Parameters ---------- alpha : float, default=1 Constant that multiplies the penalty term and thus determines the regularization strength. ``alpha = 0`` is equivalent to unpenalized GLMs. In this case, the design matrix `X` must have full column rank (no collinearities).

fit_intercept : bool, default=True Specifies if a constant (a.k.a. bias or intercept) should be added to the linear predictor (X @ coef + intercept).

max_iter : int, default=100 The maximal number of iterations for the solver.

tol : float, default=1e-4 Stopping criterion. For the lbfgs solver, the iteration will stop when ``max |g_j|, j = 1, ..., d <= tol`` where ``g_j`` is the j-th component of the gradient (derivative) of the objective function.

warm_start : bool, default=False If set to ``True``, reuse the solution of the previous call to ``fit`` as initialization for ``coef_`` and ``intercept_`` .

verbose : int, default=0 For the lbfgs solver set verbose to any positive number for verbosity.

Attributes ---------- coef_ : array of shape (n_features,) Estimated coefficients for the linear predictor (`X @ coef_ + intercept_`) in the GLM.

intercept_ : float Intercept (a.k.a. bias) added to linear predictor.

n_iter_ : int Actual number of iterations used in the solver.

val fit : ?sample_weight:[> `ArrayLike ] Np.Obj.t -> x:[> `ArrayLike ] Np.Obj.t -> y:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> t

Fit a Generalized Linear Model.

Parameters ---------- X : array-like, sparse matrix of shape (n_samples, n_features) Training data.

y : array-like of shape (n_samples,) Target values.

sample_weight : array-like of shape (n_samples,), default=None Sample weights.

Returns ------- self : returns an instance of self.

val get_params : ?deep:bool -> [> tag ] Obj.t -> Dict.t

Get parameters for this estimator.

Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns ------- params : mapping of string to any Parameter names mapped to their values.

val predict : x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Predict using GLM with feature matrix X.

Parameters ---------- X : array-like, sparse matrix of shape (n_samples, n_features) Samples.

Returns ------- y_pred : array of shape (n_samples,) Returns predicted values.

val score : ?sample_weight:[> `ArrayLike ] Np.Obj.t -> x:[> `ArrayLike ] Np.Obj.t -> y:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> float

Compute D^2, the percentage of deviance explained.

D^2 is a generalization of the coefficient of determination R^2. R^2 uses squared error and D^2 deviance. Note that those two are equal for ``family='normal'``.

D^2 is defined as :math:`D^2 = 1-\fracD(y_{true,y_pred)

}

D_{null

}

`, :math:`D_null` is the null deviance, i.e. the deviance of a model with intercept alone, which corresponds to :math:`y_pred = \bary`. The mean :math:`\bary` is averaged by sample_weight. Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse).

Parameters ---------- X : array-like, sparse matrix of shape (n_samples, n_features) Test samples.

y : array-like of shape (n_samples,) True values of target.

sample_weight : array-like of shape (n_samples,), default=None Sample weights.

Returns ------- score : float D^2 of self.predict(X) w.r.t. y.

val set_params : ?params:(string * Py.Object.t) list -> [> tag ] Obj.t -> t

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form ``<component>__<parameter>`` so that it's possible to update each component of a nested object.

Parameters ---------- **params : dict Estimator parameters.

Returns ------- self : object Estimator instance.

val coef_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute coef_: get value or raise Not_found if None.

val coef_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute coef_: get value as an option.

val intercept_ : t -> [> `ArrayLike ] Np.Obj.t

Attribute intercept_: get value or raise Not_found if None.

val intercept_opt : t -> [> `ArrayLike ] Np.Obj.t option

Attribute intercept_: get value as an option.

val n_iter_ : t -> int

Attribute n_iter_: get value or raise Not_found if None.

val n_iter_opt : t -> int option

Attribute n_iter_: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.