Documentation
Classes
GammaRegressor

GammaRegressor

Generalized Linear Model with a Gamma distribution.

This regressor uses the ‘log’ link function.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new GammaRegressor(opts?: object): GammaRegressor;

Parameters

NameTypeDescription
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). Default Value 1
opts.fit_intercept?booleanSpecifies if a constant (a.k.a. bias or intercept) should be added to the linear predictor X @ coef\_ + intercept\_. Default Value true
opts.max_iter?numberThe maximal number of iterations for the solver. Values must be in the range \[1, inf). Default Value 100
opts.solver?"lbfgs" | "newton-cholesky"Algorithm to use in the optimization problem: Default Value 'lbfgs'
opts.tol?numberStopping 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. Values must be in the range (0.0, inf). Default Value 0.0001
opts.verbose?numberFor the lbfgs solver set verbose to any positive number for verbosity. Values must be in the range \[0, inf). Default Value 0
opts.warm_start?booleanIf set to true, reuse the solution of the previous call to fit as initialization for coef\_ and intercept\_. Default Value false

Returns

GammaRegressor

Defined in: generated/linear_model/GammaRegressor.ts:25 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

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

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/linear_model/GammaRegressor.ts:138 (opens in a new tab)

fit()

Fit a Generalized Linear Model.

Signature

fit(opts: object): Promise<any>;

Parameters

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

Returns

Promise<any>

Defined in: generated/linear_model/GammaRegressor.ts:155 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

get_metadata_routing(opts: object): Promise<any>;

Parameters

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

Returns

Promise<any>

Defined in: generated/linear_model/GammaRegressor.ts:204 (opens in a new tab)

init()

Initializes the underlying Python resources.

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

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/linear_model/GammaRegressor.ts:92 (opens in a new tab)

predict()

Predict using GLM with feature matrix X.

Signature

predict(opts: object): Promise<any[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeSamples.

Returns

Promise<any[]>

Defined in: generated/linear_model/GammaRegressor.ts:239 (opens in a new tab)

score()

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).

Signature

score(opts: object): Promise<number>;

Parameters

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

Returns

Promise<number>

Defined in: generated/linear_model/GammaRegressor.ts:276 (opens in a new tab)

set_fit_request()

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:

Signature

set_fit_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in fit.

Returns

Promise<any>

Defined in: generated/linear_model/GammaRegressor.ts:327 (opens in a new tab)

set_score_request()

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:

Signature

set_score_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in score.

Returns

Promise<any>

Defined in: generated/linear_model/GammaRegressor.ts:366 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/linear_model/GammaRegressor.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/linear_model/GammaRegressor.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/linear_model/GammaRegressor.ts:21 (opens in a new tab)

id

string

Defined in: generated/linear_model/GammaRegressor.ts:18 (opens in a new tab)

opts

any

Defined in: generated/linear_model/GammaRegressor.ts:19 (opens in a new tab)

Accessors

coef_

Estimated coefficients for the linear predictor (X @ coef\_ + intercept\_) in the GLM.

Signature

coef_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/linear_model/GammaRegressor.ts:402 (opens in a new tab)

feature_names_in_

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

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/GammaRegressor.ts:500 (opens in a new tab)

intercept_

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

Signature

intercept_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/GammaRegressor.ts:425 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/GammaRegressor.ts:450 (opens in a new tab)

n_iter_

Actual number of iterations used in the solver.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/GammaRegressor.ts:475 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/linear_model/GammaRegressor.ts:79 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/linear_model/GammaRegressor.ts:83 (opens in a new tab)