Cross Validation Methods¶
Functions for cross validation
-
class
fitr.criticism.cross_validation.
LOACV
(cv_func)¶ Look-one-ahead cross validation
Attributes: - cv_func : loacv function
A look-one-ahead cross-validation function from a Fitr model
- results : LookOneAheadCVResult
Stores results of the cross validation
Methods
run
(params, data)Runs the Look-One-Ahead cross validation -
run
(params, data)¶ Runs the Look-One-Ahead cross validation
Parameters: - params : ndarray(shape=(nsubjects, nparams))
Array of parameters
- data : dict
Behavioural data in Fitr OptimizationData format
-
class
fitr.criticism.cross_validation.
LookOneAheadCVResult
(params)¶ Stores and manipulates results of a Look-One-Ahead cross-validation run
Attributes: - nsubjects : dict
Dictionary of
- accuracy : dict
Dictionary of accuracy values (overall and by subject)
- raw : dict
Dictionary
Methods
accuracy_hist
([save_figure, filename, figsize])Plots moving average of accuracy accuracy_maplot
([save_figure, filename, figsize])Plots moving average of accuracy accuracy_param_scatter
([paramnames, ylim, …])Plots accuracy against parameter values. -
accuracy_hist
(save_figure=False, filename='accuracy-hist.pdf', figsize=None)¶ Plots moving average of accuracy
Parameters: - save_figure : bool
Whether to save the plot
- filename : str
Name of the file to which figure will be saved
- figsize : (optional) tuple (width, height)
The size of the figure
-
accuracy_maplot
(save_figure=False, filename='accuracy-maplot.pdf', figsize=None)¶ Plots moving average of accuracy
Parameters: - save_figure : bool
Whether to save the plot
- filename : str
Name of the file to which figure will be saved
- figsize : (optional) tuple (width, height)
The size of the figure
-
accuracy_param_scatter
(paramnames=None, ylim=None, alpha=0.5, save_figure=False, filename='accuracy-param-scatter.pdf', figsize=None)¶ Plots accuracy against parameter values. Helpful to visually inspect the effects of various parameters on cross-validation accuracy
Parameters: - paramnames : (optional) list
List of parameter names in strings
- ylim : (optional) tuple (min, max)
Y-axis limits
- alpha : 0 < float < 1
Transparency of the plot points
- save_figure : bool
Whether to save the plot
- filename : str
Name of the file to which figure will be saved
- figsize : (optional) tuple (width, height)
The size of the figure
Returns: - matplotlib.pyplot.figure