curvefit.core.parameter.ParameterSet
A set of parameters that together specify the functional form of a curve
A ParameterSet
is a set of parameters that define the functional form for the curve.
For example, if the parametric curve you want
to fit has three parameters then you need 1 ParameterSet
objects that consists of 3 Parameter
objects.
A ParameterSet
is made up of one or more
Parameter
objects, which are each made up of one or more Variable
objects.
Please refer to their documentation for more details on those objects.
A ParameterSet
can also encode functional priors -- priors for functions of the parameter list that is
passed into a ParameterSet
.
Arguments
parameters (List[curvefit.core.parameter.Parameter])
: a list ofParameter
instancesparameter_functions (List[Tuple[Callable, List[float]]]
: a list of tuples which each contain (0) functions to apply to theparameters
list and (1) a prior for the parameter function (mean and standard deviation -- seeVariable
for more details about priors)
Attributes
All attributes from the Parameter
s in the list in the parameters
argument are carried over to
ParameterSet
but they are put into a list. For example, the fe_init
attribute for ParameterSet
is a list of
the fe_init
attributes for each Parameter
in the order that they were passed in parameters
list (which
are lists of fe_inits
for each Variable
within a Parameter
(see here for more).
Additional attributes that are not lists of the individual Parameter
attributes are listed below.
self.num_fe (int)
: total number of effects for the parameter set (number of variables)
Methods
delete_random_effects
Returns a copy of itself but with random effects bounds set to 0. This means that the parameter set will not have any random effects in the model. Useful for when the same parameter set will be used to fit jointly to many groups before being fit to individual groups.
Usage
from curvefit.core.parameter import Parameter, Variable, ParameterSet
var = Variable(covariate='ones', var_link_fun=lambda x: x, fe_init=0., re_init=0.)
param = Parameter(param_name='alpha', link_fun=lambda x: x, variables=[var])
param_function = ParameterFunction(
param_function_name='alpha_squared',
param_function=lambda params: params[0] ** 2,
param_function_fe_gprior=[0., np.inf]
)
param_set = ParameterSet(
parameters=[param], parameter_functions=[param_function]
)