PTMLocScale.optimize_knots()#
- PTMLocScale.optimize_knots(optimize_params=None, maxiter=10000, knot_prob_levels=(0.0, 1.0), **optim_args)[source]#
Finds good knots for the transformation function.
This function runs stochastic gradient descent on the location and scale model parts while fixing the transformation function to a straight line. This yields a preliminary set of residuals, which are then used to define the new knots for the transformation function’s spline segment.
Parameterss#
- *optimize_params
The parameters to optimize. If not specified, uses the parameters of the location and scale models, but not their hyperparameters. Do not include the normalization parameters here. The values supplied here should be lists of strings. Each string should be the name of a parameter in the model. Each list is a group of parameters that should be optimized together while holding the remaining parameters of the model fixed.
- maxiter
Additional argument to pass to the optimizer
optmize_parameters()
.- knot_prob_levels
At which probability levels of the observed residuals in
graph
should the new minimum and maximum knots be placed.- **optim_args
Additional arguments to pass to the optimizer
optmize_parameters()
.
- rtype:
tuple
[PTMLocScale
,dict
[str
,Any
]]- returns:
A tuple. The first element is a new instance of
PTMLocScale
withimproved knots. The second element is a position dictionary, holding the
final parameter values from the initial optimization for possible further
use.