adelie.glm.binomial#

adelie.glm.binomial(y: ndarray, *, weights: ndarray | None = None, link: str = 'logit', dtype: float32 | float64 | None = None)[source]#

Creates a Binomial GLM family object.

The Binomial GLM family with the logit link function specifies the loss function as:

(η)=i=1nwi(yiηi+log(1+eηi))

The link function is given by

g(μ)i=log(μi1μi)

The Binomial GLM family with the probit link function specifies the loss function as:

(η)=i=1nwi(yilog(Φ(ηi))+(1yi)log(1Φ(ηi)))

where Φ is the standard normal CDF. The link function is given by

g(μ)i=Φ1(μi)

We assume that yi[0,1].

Parameters:
y(n,) ndarray

Response vector y.

weights(n,) ndarray, optional

Observation weights W. Weights are normalized such that they sum to 1. Default is None, in which case, it is set to np.full(n, 1/n).

linkstr, optional

The link function type. It must be one of the following:

  • "logit": the logit link function.

  • "probit": the probit link function.

Default is "logit".

dtypeUnion[float32, float64], optional

The underlying data type. If None, it is inferred from y, in which case y must have an underlying data type of numpy.float32 or numpy.float64. Default is None.

Returns:
glm

Binomial GLM object.