LibSvmModel Class |
Namespace: Accord.IO
The LibSvmModel type exposes the following members.
Name | Description | |
---|---|---|
LibSvmModel |
Creates a new LibSvmModel object.
|
Name | Description | |
---|---|---|
Bias |
Gets or sets whether an initial double value should
be appended in the beginning of every feature vector.
If set to a negative number, this functionality is
disabled. Default is 0.
| |
Classes | Obsolete.
Obsolete. Please use NumberOfClasses instead.
| |
Dimension | Obsolete.
Obsolete. Please use NumberOfInputs instead.
| |
Labels |
Gets or sets the class label for each class
this classification model expects to handle.
| |
NumberOfClasses |
Gets or sets the number of classes that
this classification model can handle.
| |
NumberOfInputs |
Gets or sets the number of dimensions (features)
the classification or regression model can handle.
| |
Solver |
Gets or sets the solver type used to create the model.
| |
Vectors |
Gets or sets the set of support vectors used
by this model. If the model is compact, this
will be set to null.
| |
Weights |
Gets or sets the vector of linear weights used
by this model, if it is a compact model. If this
is not a compact model, this will be set to null.
|
Name | Description | |
---|---|---|
CreateAlgorithm |
Creates a support
vector machine learning algorithm that attends the
requisites specified in this model.
| |
CreateMachine |
Creates a SupportVectorMachine that
attends the requisites specified in this model.
| |
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.) | |
FromMachine |
Creates a LibSvmModel from an existing SupportVectorMachineTKernel.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Load(Stream) |
Loads a model specified using LibSVM's model format from a stream.
| |
Load(String) |
Loads a model specified using LibSVM's model format from disk.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Save(Stream) |
Saves this model to disk using LibSVM's model format.
| |
Save(String) |
Saves this model to disk using LibSVM's model format.
| |
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.) |
This class can be used to import LibSVM or LibLINEAR models into .NET and use them to make predictions in .NET/C# applications.
If you are looking for ways to load and save SVM models in the Accord.NET Framework without necessarily being compatible with LibSVM or LIBLINEAR, please use the Serializer class instead.
// Let's say we have used LIBLINEAR to learn a linear SVM model that has // been stored in a text file named "svm.txt". We would like to load this // same model in .NET and use it to make predictions using C#. // // First, we use LibSvmModel.Load to load the LIBLINEAR model from disk: LibSvmModel model = LibSvmModel.Load(Path.Combine(basePath, "svm.txt")); // Now, we can use the model class to create the equivalent Accord.NET SVM: SupportVectorMachine svm = model.CreateMachine(); // Now, we can use this machine normally, like as shown in the // examples in the Support Vector Machine documentation page.