public abstract class LibSVMModel<T extends Output<T>> extends Model<T> implements Serializable
See:
Chang CC, Lin CJ. "LIBSVM: a library for Support Vector Machines" ACM transactions on intelligent systems and technology (TIST), 2011.for the nu-svm algorithm:
Schölkopf B, Smola A, Williamson R, Bartlett P L. "New support vector algorithms" Neural Computation, 2000, 1207-1245.and for the original algorithm:
Cortes C, Vapnik V. "Support-Vector Networks" Machine Learning, 1995.
Modifier and Type | Field and Description |
---|---|
protected List<libsvm.svm_model> |
models
The LibSVM models.
|
ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutput
Modifier | Constructor and Description |
---|---|
protected |
LibSVMModel(String name,
ModelProvenance description,
ImmutableFeatureMap featureIDMap,
ImmutableOutputInfo<T> outputIDInfo,
boolean generatesProbabilities,
List<libsvm.svm_model> models)
Constructs a LibSVMModel from the supplied arguments.
|
Modifier and Type | Method and Description |
---|---|
protected static libsvm.svm_model |
copyModel(libsvm.svm_model model)
Copies an svm_model, as it does not provide a copy method.
|
Optional<Excuse<T>> |
getExcuse(Example<T> example)
Generates an excuse for an example.
|
List<libsvm.svm_model> |
getInnerModels()
Returns an unmodifiable copy of the underlying list of libsvm models.
|
List<libsvm.svm_model> |
getModel()
Deprecated.
Deprecated to unify the names across LibLinear, LibSVM and XGBoost.
|
Map<String,List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>> |
getTopFeatures(int n)
Gets the top
n features associated with this model. |
copy, copy, generatesProbabilities, getExcuses, getFeatureIDMap, getName, getOutputIDInfo, getProvenance, innerPredict, predict, predict, predict, setName, toString, validate
protected List<libsvm.svm_model> models
Not final to support deserialization reordering of multidimensional regression models which have an incorrect id mapping. Will be final again in some future version which doesn't maintain serialization compatibility with 4.X.
protected LibSVMModel(String name, ModelProvenance description, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<T> outputIDInfo, boolean generatesProbabilities, List<libsvm.svm_model> models)
name
- The model name.description
- The model provenance.featureIDMap
- The features the model knows about.outputIDInfo
- The outputs the model can produce.generatesProbabilities
- Does the model generate probabilities or not?models
- The svm models themselves.@Deprecated public List<libsvm.svm_model> getModel()
public List<libsvm.svm_model> getInnerModels()
public Map<String,List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>> getTopFeatures(int n)
Model
n
features associated with this model.
If the model does not produce per output feature lists, it returns a map with a single element with key Model.ALL_OUTPUTS.
If the model cannot describe it's top features then it returns Collections.emptyMap()
.
getTopFeatures
in class Model<T extends Output<T>>
n
- the number of features to return. If this value is less than 0,
all features should be returned for each class, unless the model cannot score it's features.public Optional<Excuse<T>> getExcuse(Example<T> example)
Model
This attempts to explain a classification result. Generating an excuse may be quite an expensive operation.
This excuse either contains per class information or an entry with key Model.ALL_OUTPUTS.
The optional is empty if the model does not provide excuses.
protected static libsvm.svm_model copyModel(libsvm.svm_model model)
model
- The svm_model to copy.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.