OneclassSupportVectorLearning Class |
Note: This API is now obsolete.
Namespace: Accord.MachineLearning.VectorMachines.Learning
[ObsoleteAttribute("Please use OneclassSupportVectorLearning<TKernel> instead.")] public class OneclassSupportVectorLearning : BaseOneclassSupportVectorLearning<ISupportVectorMachine<double[]>, IKernel<double[]>, double[]>
The OneclassSupportVectorLearning type exposes the following members.
Name | Description | |
---|---|---|
OneclassSupportVectorLearning |
Initializes a new instance of the OneclassSupportVectorLearning class.
| |
OneclassSupportVectorLearning(KernelSupportVectorMachine, Double) | Obsolete.
Obsolete.
|
Name | Description | |
---|---|---|
Kernel |
Gets or sets the kernel function use to create a
kernel Support Vector Machine. If this property
is set, UseKernelEstimation will be
set to false.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Lagrange |
Gets the value for the Lagrange multipliers
(alpha) for every observation vector.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Model |
Gets or sets the classifier being learned.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Nu |
Controls the number of outliers accepted by the algorithm. This
value provides an upper bound on the fraction of training errors
and a lower bound of the fraction of support vectors. Default is 0.5
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Shrinking |
Gets or sets a value indicating whether to use
shrinking heuristics during learning. Default is true.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Token |
Gets or sets a cancellation token that can be used to
stop the learning algorithm while it is running.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
Tolerance |
Convergence tolerance. Default value is 1e-2.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
UseKernelEstimation |
Gets or sets whether initial values for some kernel parameters
should be estimated from the data, if possible. Default is true.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) |
Name | Description | |
---|---|---|
Create |
Creates an instance of the model to be learned. Inheritors
of this abstract class must define this method so new models
can be created from the training data.
(Overrides BaseOneclassSupportVectorLearningTModel, TKernel, TInputCreate(Int32, TKernel).) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Learn |
Learns a model that can map the given inputs to the desired outputs.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Run | Obsolete.
Obsolete.
(Inherited from BaseOneclassSupportVectorLearningTModel, TKernel, TInput.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
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.) |
The following example shows how to use an one-class SVM.
// Ensure that results are reproducible Accord.Math.Random.Generator.Seed = 0; // Generate some data to be learned double[][] inputs = { new double[] { +1.0312479734420776 }, new double[] { +0.99444115161895752 }, new double[] { +0.21835240721702576 }, new double[] { +0.47197291254997253 }, new double[] { +0.68701112270355225 }, new double[] { -0.58556461334228516 }, new double[] { -0.64154046773910522 }, new double[] { -0.66485315561294556 }, new double[] { +0.37940266728401184 }, new double[] { -0.61046308279037476 } }; // Create a new One-class SVM learning algorithm var teacher = new OneclassSupportVectorLearning<Linear>() { Kernel = new Linear(), // or, for example, 'new Gaussian(0.9)' Nu = 0.1 }; // Learn a support vector machine var svm = teacher.Learn(inputs); // Test the machine double[] prediction = svm.Score(inputs); // Compute the log-likelihood of the answer double ll = new LogLikelihoodLoss().Loss(prediction);