Runs one Fisher Scoring step

# S3 method for tensorflow.tensor
glm_fit_one_step(
  x,
  response,
  model,
  model_coefficients_start = NULL,
  predicted_linear_response_start = NULL,
  l2_regularizer = NULL,
  dispersion = NULL,
  offset = NULL,
  learning_rate = NULL,
  fast_unsafe_numerics = TRUE,
  name = NULL,
  ...
)

Arguments

x

float-like, matrix-shaped Tensor where each row represents a sample's features.

response

vector-shaped Tensor where each element represents a sample's observed response (to the corresponding row of features). Must have same dtype as x.

model

a string naming the model (see glm_families) or a tfp$glm$ExponentialFamily-like instance which implicitly characterizes a negative log-likelihood loss by specifying the distribuion's mean, gradient_mean, and variance.

model_coefficients_start

Optional (batch of) vector-shaped Tensor representing the initial model coefficients, one for each column in x. Must have same dtype as model_matrix. Default value: Zeros.

predicted_linear_response_start

Optional Tensor with shape, dtype matching response; represents offset shifted initial linear predictions based on model_coefficients_start. Default value: offset if model_coefficients is NULL, and tf$linalg$matvec(x, model_coefficients_start) + offset otherwise.

l2_regularizer

Optional scalar Tensor representing L2 regularization penalty. Default: NULL ie. no regularization.

dispersion

Optional (batch of) Tensor representing response dispersion.

offset

Optional Tensor representing constant shift applied to predicted_linear_response.

learning_rate

Optional (batch of) scalar Tensor used to dampen iterative progress. Typically only needed if optimization diverges, should be no larger than 1 and typically very close to 1. Default value: NULL (i.e., 1).

fast_unsafe_numerics

Optional Python bool indicating if faster, less numerically accurate methods can be employed for computing the weighted least-squares solution. Default value: TRUE (i.e., "fast but possibly diminished accuracy").

name

usesed as name prefix to ops created by this function. Default value: "fit".

...

other arguments passed to specific methods.

Value

A glm_fit object with parameter estimates, and number of required steps.

See also