tfp.glm.fit_one_step(
model_matrix,
response,
model,
model_coefficients_start=None,
predicted_linear_response_start=None,
l2_regularizer=None,
dispersion=None,
offset=None,
learning_rate=None,
fast_unsafe_numerics=True,
name=None
)
Runs one step of Fisher scoring.
Args:
model_matrix
: (Batch of)float
-like, matrix-shapedTensor
where each row represents a sample's features.response
: (Batch of) vector-shapedTensor
where each element represents a sample's observed response (to the corresponding row of features). Must have samedtype
asmodel_matrix
.model
:tfp.glm.ExponentialFamily
-like instance used to construct the negative log-likelihood loss, gradient, and expected Hessian (i.e., the Fisher information matrix).model_coefficients_start
: Optional (batch of) vector-shapedTensor
representing the initial model coefficients, one for each column inmodel_matrix
. Must have samedtype
asmodel_matrix
. Default value: Zeros.predicted_linear_response_start
: OptionalTensor
withshape
,dtype
matchingresponse
; representsoffset
shifted initial linear predictions based onmodel_coefficients_start
. Default value:offset
ifmodel_coefficients is None
, andtfp.math.matvecmul(model_matrix, model_coefficients_start) + offset
otherwise.l2_regularizer
: Optional scalarTensor
representing L2 regularization penalty, i.e.,loss(w) = sum{-log p(y[i]|x[i],w) : i=1..n} + l2_regularizer ||w||_2^2
. Default value:None
(i.e., no L2 regularization).dispersion
: Optional (batch of)Tensor
representingresponse
dispersion, i.e., as in,p(y|theta) := exp((y theta - A(theta)) / dispersion)
. Must broadcast with rows ofmodel_matrix
. Default value:None
(i.e., "no dispersion").offset
: OptionalTensor
representing constant shift applied topredicted_linear_response
. Must broadcast toresponse
. Default value:None
(i.e.,tf.zeros_like(response)
).learning_rate
: Optional (batch of) scalarTensor
used to dampen iterative progress. Typically only needed if optimization diverges, should be no larger than1
and typically very close to1
. Default value:None
(i.e.,1
).fast_unsafe_numerics
: Optional Pythonbool
indicating if solve should be based on Cholesky or QR decomposition. Default value:True
(i.e., "prefer speed via Cholesky decomposition").name
: Pythonstr
used as name prefix to ops created by this function. Default value:"fit_one_step"
.
Returns:
model_coefficients
: (Batch of) vector-shapedTensor
; represents the next estimate of the model coefficients, one for each column inmodel_matrix
.predicted_linear_response
:response
-shapedTensor
representing linear predictions based on newmodel_coefficients
, i.e.,tfp.math.matvecmul(model_matrix, model_coefficients_next) + offset
.