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:

\[\begin{align*} \ell(\eta) = \sum\limits_{i=1}^n w_i \left( -y_i \eta_i + \log(1 + e^{\eta_i}) \right) \end{align*}\]

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

\[\begin{align*} \ell(\eta) = -\sum\limits_{i=1}^n w_i \left( y_i \log(\Phi(\eta_i)) + (1-y_i) \log(1-\Phi(\eta_i)) \right) \end{align*}\]

where \(\Phi\) is the standard normal CDF.

We assume that \(y_i \in [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.