Class LibLinearClassificationModel
java.lang.Object
org.tribuo.Model<Label>
org.tribuo.common.liblinear.LibLinearModel<Label>
org.tribuo.classification.liblinear.LibLinearClassificationModel
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<org.tribuo.provenance.ModelProvenance>,Serializable,org.tribuo.ONNXExportable,org.tribuo.protos.ProtoSerializable<org.tribuo.protos.core.ModelProto>
public class LibLinearClassificationModel
extends LibLinearModel<Label>
implements org.tribuo.ONNXExportable
A
Model which wraps a LibLinear-java classification model.
It disables the LibLinear debug output as it's very chatty.
See:
Fan RE, Chang KW, Hsieh CJ, Wang XR, Lin CJ. "LIBLINEAR: A library for Large Linear Classification" Journal of Machine Learning Research, 2008.and for the original algorithm:
Cortes C, Vapnik V. "Support-Vector Networks" Machine Learning, 1995.
- See Also:
-
Field Summary
Fields inherited from class org.tribuo.common.liblinear.LibLinearModel
CURRENT_VERSION, modelsFields inherited from class org.tribuo.Model
ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutputFields inherited from interface org.tribuo.ONNXExportable
PROVENANCE_METADATA_FIELD, SERIALIZERFields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Method Summary
Modifier and TypeMethodDescriptionprotected LibLinearClassificationModelstatic LibLinearClassificationModeldeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.ai.onnx.proto.OnnxMl.ModelProtoexportONNXModel(String domain, long modelVersion) protected double[][]getTopFeatures(int n) protected org.tribuo.Excuse<Label> innerGetExcuse(org.tribuo.Example<Label> e, double[][] allFeatureWeights) The call to model.getFeatureWeights in the public methods copies the weights array so this inner method exists to save the copy in getExcuses.org.tribuo.Prediction<Label> org.tribuo.util.onnx.ONNXNodewriteONNXGraph(org.tribuo.util.onnx.ONNXRef<?> input) Methods inherited from class org.tribuo.common.liblinear.LibLinearModel
copyModel, getExcuse, getExcuses, getInnerModels, serializeMethods inherited from class org.tribuo.Model
castModel, copy, createDataCarrier, deserialize, deserializeFromFile, deserializeFromStream, generatesProbabilities, getFeatureIDMap, getName, getOutputIDInfo, getProvenance, innerPredict, predict, predict, serializeToFile, serializeToStream, setName, toString, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tribuo.ONNXExportable
saveONNXModel, serializeProvenance
-
Method Details
-
deserializeFromProto
public static LibLinearClassificationModel deserializeFromProto(int version, String className, com.google.protobuf.Any message) throws com.google.protobuf.InvalidProtocolBufferException Deserialization factory.- Parameters:
version- The serialized object version.className- The class name.message- The serialized data.- Returns:
- The deserialized object.
- Throws:
com.google.protobuf.InvalidProtocolBufferException- If the protobuf could not be parsed from themessage.
-
predict
-
getTopFeatures
-
copy
protected LibLinearClassificationModel copy(String newName, org.tribuo.provenance.ModelProvenance newProvenance) - Specified by:
copyin classorg.tribuo.Model<Label>
-
getFeatureWeights
- Specified by:
getFeatureWeightsin classLibLinearModel<Label>
-
innerGetExcuse
protected org.tribuo.Excuse<Label> innerGetExcuse(org.tribuo.Example<Label> e, double[][] allFeatureWeights) The call to model.getFeatureWeights in the public methods copies the weights array so this inner method exists to save the copy in getExcuses.If it becomes a problem then we could cache the feature weights in the model.
- Specified by:
innerGetExcusein classLibLinearModel<Label>- Parameters:
e- The example.allFeatureWeights- The feature weights.- Returns:
- An excuse for this example.
-
exportONNXModel
- Specified by:
exportONNXModelin interfaceorg.tribuo.ONNXExportable
-
writeONNXGraph
- Specified by:
writeONNXGraphin interfaceorg.tribuo.ONNXExportable
-