# Error and Learning Based Novelty Detection (ELBND)¶

New in version 1.0.0.

The Error and Learning Based Novelty Detection (ELBND)is based on the evaluation of an adaptive model error and the change of its parameters , .

## Algorithm Explanation¶

The ELBND can describe every sample with vector of values estimated from the adaptive increments of any adaptive model and the error of that model as follows

$$\textrm{ELBND}(k) = \Delta \textbf{w}(k) e(k).$$

The output is a vector of values describing novelty in given sample. To obtain single value of novelty ammount for every sample is possible to use various functions, for example maximum of absolute values.

$$\textrm{elbnd}(k) = \max |\textrm{ELBND}(k)|.$$

Other popular option is to make a sum of absolute values.

## Usage Instructions¶

The ELBND algorithm can be used as follows

elbnd = pa.detection.ELBND(w, e, function="max")


where w is matrix of the adaptive parameters (changing in time, every row should represent one time index), e is error of adaptive model and function is input function, in this case maximum.

## Minimal Working Example¶

In this example is demonstrated how can the LE highligh the position of a perturbation inserted in a data. As the adaptive model is used Normalized Least-mean-squares (NLMS) adaptive filter. The perturbation is manually inserted in sample with index $$k=1000$$ (the length of data is 2000).

import numpy as np
import matplotlib.pylab as plt

# data creation
n = 5
N = 2000
x = np.random.normal(0, 1, (N, n))
d = np.sum(x, axis=1) + np.random.normal(0, 0.1, N)

# perturbation insertion
d += 2.

# creation of learning model (adaptive filter)
f = pa.filters.FilterNLMS(n, mu=1., w=np.ones(n))
y, e, w = f.run(d, x)

# estimation of LE with weights from learning model
elbnd = pa.detection.ELBND(w, e, function="max")

# LE plot
plt.plot(elbnd)
plt.show()


## Code Explanation¶

padasip.detection.elbnd.ELBND(w, e, function='max')[source]

This function estimates Error and Learning Based Novelty Detection measure from given data.

Args:

• w : history of adaptive parameters of an adaptive model (2d array), every row represents parameters in given time index.
• e : error of adaptive model (1d array)

Kwargs:

• functions : output function (str). The way how to produce single value for every sample (from all parameters)

• max - maximal value
• sum - sum of values

Returns:

• ELBND values (1d array). This vector has same lenght as w.