Spline Class |
Namespace: Accord.Statistics.Kernels
[SerializableAttribute] public sealed class Spline : KernelBase, IKernel, IKernel<double[]>, ICloneable
The Spline type exposes the following members.
Name | Description | |
---|---|---|
Clone |
Creates a new object that is a copy of the current instance.
| |
Distance |
Computes the squared distance in feature space
between two points given in input space.
(Inherited from KernelBaseTInput.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Function |
Spline Kernel Function
(Overrides KernelBaseTInputFunction(TInput, TInput).) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Distance |
Computes the kernel distance for a kernel function even if it doesn't
implement the IDistance interface. Can be used to check
the proper implementation of the distance function.
(Defined by Tools.) | |
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
// Let's try to obtain a classifier for an // example 2D binary classification dataset: var iris = new DataSets.YinYang(); double[][] inputs = iris.Instances; bool[] outputs = iris.ClassLabels; // Create a learning algorithm with the Spline kernel var smo = new SequentialMinimalOptimization<Spline>() { // Force a complexity value C or let it be // determined automatically by a heuristic: // Complexity = 1.5 }; // Use it to learn a new s.v. machine var svm = smo.Learn(inputs, outputs); // Now we can compute predicted values bool[] predicted = svm.Decide(inputs); // And check how far we are from the expected values double error = new ZeroOneLoss(outputs).Loss(predicted); // error will be 0.20