# Custom Likelihood

While a Bayesian *Reference* type problem is for data that originate from a functional dependency,
\(d = (x_j, y_j)_{j=1...N}\;\) with \(y_j = f(x_j) + \epsilon\),
a *Custom Likelihood* model makes no such assumption.

With a *Custom Likelihood*, the function \(p(d|\vartheta)\) is given directly by a user-defined model of the form \(f:\; \mathbb{R}^N\rightarrow\mathbb{R}\), where \(N\) is the number of variables.

## Likelihood Models

### Additive Normal Likelihood

Whereas with an *Additive Normal Likelihood*, the computational model is assumed to be of the form \(f(x;\vartheta)\), where \(d\) is a set of *M* given data points. The output of the model represents the values of the function at the given points for which Korali can build a likelihood function \(p(d|\vartheta)\), and a prior probability density \(p(\vartheta)\).

Currently, Korali uses a Normal estimator for the error component of the likelihood calculation, using a statistical-type variable, *sigma*:

With a *Custom Likelihood*, the function \(p(d|\vartheta)\) is given directly by a user-defined model of the form \(f:\mathbb{R}^N\rightarrow\mathbb{R}\), where \(N\) is the number of variables.

## Usage

`e["Problem"]["Type"] = "Bayesian/Custom"`

## Variable-Specific Settings

These are settings required by this module that are added to each of the experiment’s variables when this module is selected.

- Prior Distribution
**Usage**: e[“Variables”][*index*][“Prior Distribution”] =*string***Description**: Indicates the name of the distribution to use as prior distribution.

- Distribution Index
**Usage**: e[“Variables”][*index*][“Distribution Index”] =*unsigned integer***Description**: Stores the the index number of the selected prior distribution.

- Name
**Usage**: e[“Variables”][*index*][“Name”] =*string***Description**: Defines the name of the variable.

## Configuration

These are settings required by this module.

- Likelihood Model
**Usage**: e[“Problem”][“Likelihood Model”] = Computational Model**Description**: Stores the user-defined likelihood model. It should return the value of the Log Likelihood of the given sample.

## Variable Defaults

These following configuration will be assigned to each of the experiment variables by default. Any settings defined by the user will override the given settings specified in these defaults.

{ "Distribution Index": 0 }