Wavelet Structure |
Namespace: Accord.Statistics.Kernels
[SerializableAttribute] public struct Wavelet : IKernel, IKernel<double[]>, ICloneable, IKernel<int[]>, IDistance, IDistance<double[]>, IDistance<double[], double[]>, IDistance<int[]>, IDistance<int[], int[]>
The Wavelet type exposes the following members.
Name | Description | |
---|---|---|
Wavelet(Boolean) |
Constructs a new Wavelet kernel.
| |
Wavelet(Boolean, Double) |
Constructs a new Wavelet kernel.
| |
Wavelet(Double, Double) |
Constructs a new Wavelet kernel.
| |
Wavelet(Boolean, Double, FuncDouble, Double) |
Constructs a new Wavelet kernel.
| |
Wavelet(Double, Double, FuncDouble, Double) |
Constructs a new Wavelet kernel.
|
Name | Description | |
---|---|---|
Dilation |
Gets or sets the wavelet dilation for this kernel.
| |
Invariant |
Gets or sets whether this is
an invariant Wavelet kernel.
| |
Mother |
Gets or sets the Mother wavelet for this kernel.
| |
Translation |
Gets or sets the wavelet translation for this kernel.
|
Name | Description | |
---|---|---|
Clone |
Creates a new object that is a copy of the current instance.
| |
Distance(Double, Double) |
Computes the squared distance in feature space
between two points given in input space.
| |
Distance(Int32, Int32) |
Computes the squared distance in feature space
between two points given in input space.
| |
Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType.) | |
Function(Double, Double) |
Wavelet kernel function.
| |
Function(Int32, Int32) |
Wavelet kernel function.
| |
GetHashCode | Returns the hash code for this instance. (Inherited from ValueType.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
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.) |
In Wavelet analysis theory, one of the common goals is to express or approximate a signal or function using a family of functions generated by dilations and translations of a function called the mother wavelet.
The Wavelet kernel uses a mother wavelet function together with dilation and translation constants to produce such representations and build a inner product which can be used by kernel methods. The default wavelet used by this class is the mother function h(x) = cos(1.75x)*exp(-x²/2).
References:
// Generate always same random numbers Accord.Math.Random.Generator.Seed = 0; // The following is a simple auto association function in which // the last column of each input correspond to its own class. This // problem should be easily solved using a Linear kernel. // Sample input data int[][] inputs = { new int[] { 1, 2, 0 }, new int[] { 6, 2, 3 }, new int[] { 1, 1, 1 }, new int[] { 7, 6, 2 }, }; // Output for each of the inputs int[] outputs = { 0, 3, 1, 2 }; // Create the multi-class learning algorithm for the machine var teacher = new MulticlassSupportVectorLearning<Wavelet, int[]>() { // Configure the learning algorithm to use SMO to train the // underlying SVMs in each of the binary class subproblems. Learner = (param) => new SequentialMinimalOptimization<Wavelet, int[]>() { // If you would like to use other kernels, simply replace // the generic parameter to the desired kernel class, such // as for example, Wavelet: Kernel = new Wavelet(invariant: true) // use the Wavelet kernel } }; // You can set extra properties to configure the learning if you would like: teacher.AggregateExceptions = true; teacher.ParallelOptions.MaxDegreeOfParallelism = 1; // Estimate the multi-class support vector machine using one-vs-one method var ovo = teacher.Learn(inputs, outputs); // Obtain class predictions for each sample int[] predicted = ovo.Decide(inputs); // Compute classification error double error = new ZeroOneLoss(outputs).Loss(predicted);