Runs multiple Fisher scoring steps
# S3 method for tensorflow.tensor
glm_fit(
x,
response,
model,
model_coefficients_start = NULL,
predicted_linear_response_start = NULL,
l2_regularizer = NULL,
dispersion = NULL,
offset = NULL,
convergence_criteria_fn = NULL,
learning_rate = NULL,
fast_unsafe_numerics = TRUE,
maximum_iterations = NULL,
name = NULL,
...
)
float-like, matrix-shaped Tensor where each row represents a sample's features.
vector-shaped Tensor where each element represents a sample's
observed response (to the corresponding row of features). Must have same dtype
as x
.
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.
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.
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.
Optional scalar Tensor representing L2 regularization penalty.
Default: NULL
ie. no regularization.
Optional (batch of) Tensor representing response dispersion.
Optional Tensor representing constant shift applied to predicted_linear_response
.
callable taking: is_converged_previous
, iter_
,
model_coefficients_previous
, predicted_linear_response_previous
, model_coefficients_next
,
predicted_linear_response_next
, response
, model
, dispersion
and returning
a logical Tensor indicating that Fisher scoring has converged.
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).
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").
Optional maximum number of iterations of Fisher scoring to run;
"and-ed" with result of convergence_criteria_fn
. Default value: NULL
(i.e., infinity).
usesed as name prefix to ops created by this function. Default value: "fit".
other arguments passed to specific methods.
A glm_fit
object with parameter estimates, and
number of required steps.
Other glm_fit:
glm_families
,
glm_fit_one_step.tensorflow.tensor()