pykelihood.kernels.

categories_qualitative#

categories_qualitative(x, fixed_values=None)#

Kernel for qualitative (categorical) data.

Parameters:
  • x (Collection) – The qualitative data containing categorical values (e.g., strings or integers).

  • fixed_values (dict, optional) – A dictionary specifying constant values for certain categories. The keys are the category names, and the values are the fixed parameter values.

Returns:

A kernel function that assigns a parameter to each unique value in the data.

Return type:

Kernel

Notes

The kernel creates one parameter for each unique category in the data. If fixed_values is provided, the corresponding categories will use the fixed parameters instead of creating new ones.

Examples

>>> data = ['A', 'B', 'A', 'C']
>>> kernel = categories_qualitative(data, fixed_values={'A': 1.0})