DocumentationClassesPoissonRegressor

Class: PoissonRegressor

Generalized Linear Model with a Poisson distribution.

This regressor uses the ‘log’ link function.

Read more in the User Guide.

Python Reference

Constructors

new PoissonRegressor()

new PoissonRegressor(opts?): PoissonRegressor

Parameters

ParameterTypeDescription
opts?object-
opts.alpha?numberConstant that multiplies the L2 penalty term and 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). Values of alpha must be in the range \[0.0, inf).
opts.fit_intercept?booleanSpecifies if a constant (a.k.a. bias or intercept) should be added to the linear predictor (X @ coef + intercept).
opts.max_iter?numberThe maximal number of iterations for the solver. Values must be in the range \[1, inf).
opts.solver?"lbfgs" | "newton-cholesky"Algorithm to use in the optimization problem:
opts.tol?numberStopping criterion. For the lbfgs solver, the iteration will stop when `max{
opts.verbose?numberFor the lbfgs solver set verbose to any positive number for verbosity. Values must be in the range \[0, inf).
opts.warm_start?booleanIf set to true, reuse the solution of the previous call to fit as initialization for coef_ and intercept_ .

Returns PoissonRegressor

Defined in generated/linear_model/PoissonRegressor.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/linear_model/PoissonRegressor.ts:23
_isInitializedbooleanfalsegenerated/linear_model/PoissonRegressor.ts:22
_pyPythonBridgeundefinedgenerated/linear_model/PoissonRegressor.ts:21
idstringundefinedgenerated/linear_model/PoissonRegressor.ts:18
optsanyundefinedgenerated/linear_model/PoissonRegressor.ts:19

Accessors

coef_

Get Signature

get coef_(): Promise<any[]>

Estimated coefficients for the linear predictor (X @ coef_ + intercept_) in the GLM.

Returns Promise<any[]>

Defined in generated/linear_model/PoissonRegressor.ts:394


feature_names_in_

Get Signature

get feature_names_in_(): Promise<ArrayLike>

Names of features seen during fit. Defined only when X has feature names that are all strings.

Returns Promise<ArrayLike>

Defined in generated/linear_model/PoissonRegressor.ts:475


intercept_

Get Signature

get intercept_(): Promise<number>

Intercept (a.k.a. bias) added to linear predictor.

Returns Promise<number>

Defined in generated/linear_model/PoissonRegressor.ts:421


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/linear_model/PoissonRegressor.ts:448


n_iter_

Get Signature

get n_iter_(): Promise<number>

Actual number of iterations used in the solver.

Returns Promise<number>

Defined in generated/linear_model/PoissonRegressor.ts:502


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/PoissonRegressor.ts:79

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/linear_model/PoissonRegressor.ts:133


fit()

fit(opts): Promise<any>

Fit a Generalized Linear Model.

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLikeTraining data.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/linear_model/PoissonRegressor.ts:150


get_metadata_routing()

get_metadata_routing(opts): Promise<any>

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Parameters

ParameterTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns Promise<any>

Defined in generated/linear_model/PoissonRegressor.ts:196


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/linear_model/PoissonRegressor.ts:92


predict()

predict(opts): Promise<any[]>

Predict using GLM with feature matrix X.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeSamples.

Returns Promise<any[]>

Defined in generated/linear_model/PoissonRegressor.ts:232


score()

score(opts): Promise<number>

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 uses the deviance of this GLM, see the User Guide.

D^2 is defined as \(D^2 = 1-\frac{D(y_{true},y_{pred})}{D_{null}}\), \(D_{null}\) is the null deviance, i.e. the deviance of a model with intercept alone, which corresponds to \(y_{pred} = \bar{y}\). The mean \(\bar{y}\) is averaged by sample_weight. Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse).

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLikeTest samples.
opts.y?ArrayLikeTrue values of target.

Returns Promise<number>

Defined in generated/linear_model/PoissonRegressor.ts:270


set_fit_request()

set_fit_request(opts): Promise<any>

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in fit.

Returns Promise<any>

Defined in generated/linear_model/PoissonRegressor.ts:318


set_score_request()

set_score_request(opts): Promise<any>

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in score.

Returns Promise<any>

Defined in generated/linear_model/PoissonRegressor.ts:358