Module: tfp.glm

TensorFlow Probability GLM python package.

Classes

class Bernoulli: Bernoulli(probs=mean) where mean = sigmoid(X @ weights).

class BernoulliNormalCDF: Bernoulli(probs=mean) where mean = Normal(0, 1).cdf(X @ weights).

class Binomial: Binomial(total_count, probs=mean).

class CustomExponentialFamily: Constucts GLM from arbitrary distribution and inverse link function.

class ExponentialFamily: Specifies a mean-value parameterized exponential family.

class GammaExp: Gamma(concentration=1, rate=1 / mean) where mean = exp(X @ w)).

class GammaSoftplus: Gamma(concentration=1, rate=1 / mean) where mean = softplus(X @ w)).

class LogNormal: LogNormal(loc=log(mean) - log(2) / 2, scale=sqrt(log(2))) where mean = exp(X @ weights).

class LogNormalSoftplus: LogNormal(loc=log(mean) - log(2) / 2, scale=sqrt(log(2))) mean = softplus(X @ weights).

class NegativeBinomial: NegativeBinomial(total_count, probs=mean / (mean + total_count)).

class NegativeBinomialSoftplus: NegativeBinomial(total_count, probs=mean / (mean + total_count)).

class Normal: Normal(loc=mean, scale=1) where mean = X @ weights.

class NormalReciprocal: Normal(loc=mean, scale=1) where mean = 1 / (X @ weights).

class Poisson: Poisson(rate=mean) where mean = exp(X @ weights).

class PoissonSoftplus: Poisson(rate=mean) where mean = softplus(X @ weights).

Functions

compute_predicted_linear_response(...): Computes model_matrix @ model_coefficients + offset.

convergence_criteria_small_relative_norm_weights_change(...): Returns Python callable which indicates fitting procedure has converged.

fit(...): Runs multiple Fisher scoring steps.

fit_one_step(...): Runs one step of Fisher scoring.

fit_sparse(...): Fits a GLM using coordinate-wise FIM-informed proximal gradient descent.

fit_sparse_one_step(...): One step of (the outer loop of) the GLM fitting algorithm.