Definition of a kernel function as a ReClaM model. More...
#include <KernelFunction.h>
Public Member Functions | |
| KernelFunction () | |
| Constructor. | |
| virtual | ~KernelFunction () |
| Destructor. | |
| virtual double | eval (const Array< double > &x1, const Array< double > &x2) const =0 |
| Evaluates the kernel function on a const object. | |
| virtual double | evalDerivative (const Array< double > &x1, const Array< double > &x2, Array< double > &derivative) const |
| Evaluates the kernel function and computes its derivatives w.r.t. | |
| double | operator() (const Array< double > &x1, const Array< double > &x2) |
| Kernel evaluation in the form of an operator. | |
| void | model (const Array< double > &input, Array< double > &output) |
| The Model behaviour of the KernelFunction is to interpret the input as a matrix of two vectors and to compute the kernel value on them. | |
| void | modelDerivative (const Array< double > &input, Array< double > &derivative) |
| Same as model, additionally the derivatives w.r.t. | |
| void | modelDerivative (const Array< double > &input, Array< double > &output, Array< double > &derivative) |
| Same as model, additionally the derivatives w.r.t. | |
Friends | |
| class | C_SVM |
Definition of a kernel function as a ReClaM model.
The interpretation of a kernel function as a ReClaM Model involves some complications. We have to cope with the problem that the Model usually produces one output per input, while the KernelFunction produces one output for a pair of inputs. Nevertheless, we want the KernelFunction to be a parameterized ReClaM Model for the sake of optimization. For simplicity, the input data are required to be matrices composed of exactly two columns for KernelFunction Models. For this reason, the KernelFunction provides an additional interface through its virtual members eval and evalDerivative that should be overriden. The inherited members model and modelDerivative redirect to this interface.
The modelDerivative member considerably differs from the standard behavior as it requires a two dimensional input array (holding two input patterns). Usually, only one input pattern is allowed for derivative computations. On the other hand, the derivative array is one dimensional, indexed only by the kernel parameters.
According to the differences between KernelFunction and Model it is advisable to use the eval and evalDerivative interface whenever it is clear that the object under consideration is a KernelFunction.
Definition at line 79 of file KernelFunction.h.
| KernelFunction::KernelFunction | ( | ) |
Constructor.
Definition at line 52 of file KernelFunction.cpp.
| KernelFunction::~KernelFunction | ( | ) | [virtual] |
Destructor.
Definition at line 56 of file KernelFunction.cpp.
| virtual double KernelFunction::eval | ( | const Array< double > & | x1, | |
| const Array< double > & | x2 | |||
| ) | const [pure virtual] |
Evaluates the kernel function on a const object.
Implemented in DiagGaussKernel, GeneralGaussKernel, LinearKernel, PolynomialKernel, RBFKernel, NormalizedRBFKernel, NormalizedKernel, WeightedSumKernel, WeightedSumKernel2, and PrototypeKernel.
Referenced by SvmApproximation::addVecFixPointIteration(), SvmApproximation::calcOffsetForReducedModel(), SvmApproximation::calcOptimalAlphaOfApproximatedSVM(), KernelNearestNeighbor::classify(), KernelKMeans::clusterVectors(), InputLabelMatrix::Entry(), KernelMatrix::Entry(), SvmApproximation::error(), NegativePolarization::error(), NegativeBKTA::error(), NegativeKTA::error(), InverseClassSeparability::error(), SvmApproximationErrorFunctionGlobal::errorDerivative(), SvmApproximationErrorFunction::errorDerivative(), JointKernelFunction::eval(), NormalizedKernel::eval(), evalDerivative(), SVM::model(), KernelMeanClassifier::model(), model(), SVM::modelDerivative(), MultiClassSVM::Normalize(), operator()(), SVM_Optimizer::optimize(), MultiClassSVM::Predict(), KernelNearestNeighbor::Recalc(), KernelMeanClassifier::Recalc(), RadiusMargin::solveProblems(), and KernelKMeans::updateFandG().
| double KernelFunction::evalDerivative | ( | const Array< double > & | x1, | |
| const Array< double > & | x2, | |||
| Array< double > & | derivative | |||
| ) | const [virtual] |
Evaluates the kernel function and computes its derivatives w.r.t.
the kernel parameters.
Reimplemented in DiagGaussKernel, GeneralGaussKernel, LinearKernel, RBFKernel, NormalizedRBFKernel, NormalizedKernel, WeightedSumKernel, WeightedSumKernel2, and PrototypeKernel.
Definition at line 61 of file KernelFunction.cpp.
References Model::epsilon, eval(), Model::getParameter(), Model::getParameterDimension(), and i.
Referenced by GaussianProcessEvidence::dEvidenceDTheta(), RadiusMargin::errorDerivative(), NegativePolarization::errorDerivative(), NegativeBKTA::errorDerivative(), NegativeKTA::errorDerivative(), InverseClassSeparability::errorDerivative(), JointKernelFunction::evalDerivative(), NormalizedKernel::evalDerivative(), C_SVM::modelDerivative(), modelDerivative(), and C_SVM::PrepareDerivative().
| void KernelFunction::model | ( | const Array< double > & | input, | |
| Array< double > & | output | |||
| ) | [virtual] |
The Model behaviour of the KernelFunction is to interpret the input as a matrix of two vectors and to compute the kernel value on them.
Implements Model.
Definition at line 82 of file KernelFunction.cpp.
References eval().
| void KernelFunction::modelDerivative | ( | const Array< double > & | input, | |
| Array< double > & | output, | |||
| Array< double > & | derivative | |||
| ) | [virtual] |
Same as model, additionally the derivatives w.r.t.
all kernel parameters are computed.
Reimplemented from Model.
Definition at line 93 of file KernelFunction.cpp.
References evalDerivative().
| void KernelFunction::modelDerivative | ( | const Array< double > & | input, | |
| Array< double > & | derivative | |||
| ) | [virtual] |
Same as model, additionally the derivatives w.r.t.
all kernel parameters are computed.
Reimplemented from Model.
Definition at line 88 of file KernelFunction.cpp.
References evalDerivative().
| double KernelFunction::operator() | ( | const Array< double > & | x1, | |
| const Array< double > & | x2 | |||
| ) | [inline] |
Kernel evaluation in the form of an operator.
Definition at line 97 of file KernelFunction.h.
References eval().
friend class C_SVM [friend] |
Definition at line 115 of file KernelFunction.h.