mot.cl_routines package

Submodules

mot.cl_routines.numerical_hessian module

Module contents

mot.cl_routines.compute_log_likelihood(ll_func, parameters, data=None, cl_runtime_info=None)[source]

Calculate and return the log likelihood of the given model for the given parameters.

This calculates the log likelihoods for every problem in the model (typically after optimization), or a log likelihood for every sample of every model (typically after sample). In the case of the first (after optimization), the parameters must be an (d, p) array for d problems and p parameters. In the case of the second (after sample), you must provide this function with a matrix of shape (d, p, n) with d problems, p parameters and n samples.

Parameters:
  • ll_func (mot.lib.cl_function.CLFunction) –

    The log-likelihood function. A CL function with the signature:

    double <func_name>(local const mot_float_type* const x, void* data);
    
  • parameters (ndarray) – The parameters to use in the evaluation of the model. This is either an (d, p) matrix or (d, p, n) matrix with d problems, p parameters and n samples.
  • data (mot.lib.kernel_data.KernelData) – the user provided data for the void* data pointer.
  • cl_runtime_info (mot.configuration.CLRuntimeInfo) – the runtime information
Returns:

per problem the log likelihood, or, per problem and per sample the log likelihood.

Return type:

ndarray

mot.cl_routines.compute_objective_value(objective_func, parameters, data=None, cl_runtime_info=None)[source]

Calculate and return the objective function value of the given model for the given parameters.

Parameters:
  • objective_func (mot.lib.cl_function.CLFunction) –

    A CL function with the signature:

    double <func_name>(local const mot_float_type* const x,
                       void* data,
                       local mot_float_type* objective_list);
    
  • parameters (ndarray) – The parameters to use in the evaluation of the model, an (d, p) matrix with d problems and p parameters.
  • data (mot.lib.kernel_data.KernelData) – the user provided data for the void* data pointer.
  • cl_runtime_info (mot.configuration.CLRuntimeInfo) – the runtime information
Returns:

vector matrix with per problem the objective function value

Return type:

ndarray