KernelType enum

A type of a kernel function.

Defines a way the weights of the nearest observations are being calculated for K nearest neighbours algorithm (KNN).

Pure KNN algorithm does not consider how far is a particular observation from the target one and it generally leads to imprecise prediction.

To avoid such a behaviour, one may use a kernel function, that accepts a distance between an observation being evaluated and the target one and returns a weight denoting, how much the evaluating observation will contribute in prediction for the target one.

Inheritance

Constructors

KernelType()
const

Values

uniform → const KernelType

A kernel that calculates weights using the following formula:

K(x,\lambda)=\left{\begin{matrix}1/2,&|x|\leqslant\lambda\0,&|x|>\lambda\end{matrix}\right.

epanechnikov → const KernelType

A kernel that calculates weights using the following formula:

K(x,\lambda)=\left{\begin{matrix}3/4(1-x^{2}),&|x|\leqslant\lambda\0,&|x|>\lambda\end{matrix}\right.

cosine → const KernelType

A kernel that calculates weights using the following formula:

K(x,\lambda)=\left{\begin{matrix} 0.25\pi cos(0.5\pi x), & |x|\leqslant \lambda \ 0, & |x|>\lambda \end{matrix}\right.

gaussian → const KernelType

A kernel that calculates weights using the following formula:

K(x)=\frac{1 }{\sqrt{2\pi }} e^{-\frac{1}{2}x^{2}}

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<KernelType>
A constant List of the values in this enum, in order of their declaration.