Class gmm_python (o2scl)

O2scl : Class List

class gmm_python

Multidimensional interpolation interface for python.

Public Functions

gmm_python()
virtual ~gmm_python()
gmm_python(std::string module, size_t n_comp, const o2scl::tensor<> &params, std::string options = "", std::string class_name = "", int v = 0)

Specify the Python module and function.

void free()

Free the associated memory.

int set_function(std::string module, size_t n_comp, const o2scl::tensor<> &params, std::string options = "", std::string class_name = "", int v = 0)

Specify the python and the parameters.

This function is called by the constructor and thus cannot be virtual.

virtual int components(const std::vector<double> &x, std::vector<double> &y) const

At point x, compute the components for each Gaussian in the mixture and place the result in y.

virtual int get_python()

Compute the function at point x and return the result.

inline std::shared_ptr<prob_dens_mdim_gmm<>> get_gmm()

Get the underlying Gaussian mixture probability density.

Public Members

std::string set_func

The name of the Python set function (default “set_data_str”)

std::string get_func

The name of the Python get function (default “get_data”)

std::string components_func

The name of the Python components function (default “components”)

std::string log_pdf_func

The name of the Python components function (default “log_pdf”)

int verbose

Verbosity parameter.

Protected Functions

void *get_python_internal(int &ret)

An internal version of get_python which returns a void * for the import_array() macro.

void *set_function_internal(std::string module, size_t n_comp, const o2scl::tensor<> &params, std::string options, std::string class_name, int v, int &ret)

Internal version of set_function() which returns a void * for the import_array() macro.

Note that the params object is only used for the duration of this function and can be destroyed afterwards

Protected Attributes

PyObject *p_module

Python module containing function.

PyObject *p_class

The class.

PyObject *p_instance

An instance of the class.

PyObject *p_set_args

Function arguments.

PyObject *p_components_args

Function arguments.

PyObject *p_get_args

Function arguments.

PyObject *p_set_func

Python function.

PyObject *p_components_func

Python function.

PyObject *p_get_func

Python function.

size_t n_params

Number of parameters.

size_t n_points

Number of points.

size_t n_components

Number of components.

std::shared_ptr<prob_dens_mdim_gmm<>> pdm_gmm

Underlying probability distribution.

Private Functions

gmm_python(const gmm_python&)
gmm_python &operator=(const gmm_python&)