Evaluation¶
This module is for paralellizing likelihood estimation using the model. When getting the model likelihood for large data sets or when computing it many times it may be beneficial to paralellize the get_scanpath_likelihood function. This paralellized evaluateion of the model can happen at the level of subjects (run each on different cores) and/or at the level of trials (split trials into groups and run these groups in parallel).
num_processes_subj
is the number of processes between which the subjects are split.
num_processes_trials
is the number of processes within each subject, i.e. the number of cores the trials are spread onto.
The main relevant function to call from the outside is
-
scenewalk.evaluation.evaluate_sw_parallel.
get_neg_tot_like_parallel
(sw_model, x_dat, y_dat, dur_dat, im_dat, densities_dat, num_processes_subjs, num_processes_trials=1)¶ Scenewalk evaluation parallelized by subject. This is what you call from the outside giving it a list of people
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- num_processes_subjsint
number of cores to parallelize the model evaluation over. Max: number of subjects in the given dataset
- num_processes_trialsint
number of cores to parallelize the model evaluation over. Max: number of trials in the given dataset
- Returns
- float
Full Estimation Doc¶
Get scenewalk log likelihood of dataset using paralellization Lisa Schwetlick 2019 University of Potsdam
-
scenewalk.evaluation.evaluate_sw_parallel.
do_multiprocess_subjs
(function_args, num_processes)¶ Opens pool of workers for parallelization
- Parameters
- function_argslist
list of args to pass to Estimation
- num_processesint
how many pararell processes we want to run for subjects (between subj)
- Returns
- list
results_list: total sum for evaluation on dataset
-
scenewalk.evaluation.evaluate_sw_parallel.
do_multiprocess_trials
(function_args, num_processes)¶ Opens pool of workers for parallelization
- Parameters
- function_argslist
list of args to pass to Estimation
- num_processesint
how many pararell processes we want to run for trials (within subj)
- Returns
- list
results_list: total sum for evaluation on dataset
-
scenewalk.evaluation.evaluate_sw_parallel.
get_neg_tot_like_parallel
(sw_model, x_dat, y_dat, dur_dat, im_dat, densities_dat, num_processes_subjs, num_processes_trials=1) Scenewalk evaluation parallelized by subject. This is what you call from the outside giving it a list of people
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- num_processes_subjsint
number of cores to parallelize the model evaluation over. Max: number of subjects in the given dataset
- num_processes_trialsint
number of cores to parallelize the model evaluation over. Max: number of trials in the given dataset
- Returns
- float
-
scenewalk.evaluation.evaluate_sw_parallel.
get_neg_tot_like_trials_parallel
(sw_model, x_dat, y_dat, dur_dat, im_dat, densities_dat, num_processes)¶ Scenewalk evaluation parallelized by subject. Call this function from the outside by giving it one person’s trials.
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- num_processesint
number of cores to parallelize the model trial evaluation over
- Returns
- list
results_list: total sum for evaluation on dataset
-
scenewalk.evaluation.evaluate_sw_parallel.
get_total_list_LL_trials
(sw_model, x_dat, y_dat, dur_dat, im_dat, densities_dat)¶ Gives a list containing a LL for each scanpath
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- Returns
- array
list of LLs for evaluation on subdataset
-
scenewalk.evaluation.evaluate_sw_parallel.
get_total_neg_LL_per_subj
(sw_model, x_dat_sub, y_dat_sub, dur_dat_sub, im_dat_sub, densities_dat)¶ Iterate over all images one subject saw and returns the negative Log Likelihood given parameters. (Linear)
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- Returns
- float
negative sum of likelihoods of all trials in a subject
-
scenewalk.evaluation.evaluate_sw_parallel.
get_total_neg_LL_subjs
(sw_model, x_dat, y_dat, dur_dat, im_dat, densities_dat, num_processes_trials)¶ Calls get_total_neg_LL_per_subj() for every subject and returns the sum
- Parameters
- sw_modelscenewalk model object
scenewalk model object
- x_dat, y_dat, dur_dat, im_datarrays
data of shape subject[trial[path[]]] either of whole dataset or of a subset (trials running in one pool)
- densities_datarray
empirical densities
- Returns
- float
total sum for evaluation on subdataset
-
scenewalk.evaluation.evaluate_sw_parallel.
multi_process_like_subjs
(args)¶ unpack args to multi process function
-
scenewalk.evaluation.evaluate_sw_parallel.
multi_process_like_trials
(args)¶ unpack args to multi process function