Fitmodel: High Level Model-Fitting Wrapper¶
-
class
fitr.inference.fitmodel.FitModel(name='Anon Model', loglik_func=None, params=None, generative_model=None)¶ An object representing a model to be fit to behavioural data. This should be viewed as a high level wrapper for multiple potential model fitting algorithms which themselves can be run by using their respective classes.
Attributes
name (str) Name of the model. We suggest identifying model based on free parameters. loglik_func (function) The log-likelihood function to be used to fit the data params (list) List of reinforcement learning parameter objects from the rlparams module. generative_model (GenerativeModel object) Object representing a generative model Methods
fit(data, method=’EM’, c_limit=0.01) Runs the specified model fitting algorithm with the given data. -
fit(data, method='EM', c_limit=0.01, verbose=True)¶ Runs model fitting
Parameters: data : dict
Behavioural data.
method : {‘EM’, ‘MLE’, ‘EmpiricalPriors’, ‘MCMC’}
The inference algorithm to use. Note that the data formats for ‘MCMC’ compared to the other methods is distinct, and should correspond appropriately to the method being employed
c_limit : float
Limit at which convergence of log-posterior probability is determined (only for methods ‘EM’ and ‘EmpiricalPriors’)
verbose : bool
Controls amount of printed output during model fitting
Returns: fitrfit : object
Representation of the model fitting results
-