Class KernelSVMModel

java.lang.Object
org.tribuo.Model<Label>
org.tribuo.classification.sgd.kernel.KernelSVMModel
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<org.tribuo.provenance.ModelProvenance>, Serializable, org.tribuo.protos.ProtoSerializable<org.tribuo.protos.core.ModelProto>

public class KernelSVMModel extends org.tribuo.Model<Label>
The inference time version of a kernel model trained using Pegasos.

See:

 Shalev-Shwartz S, Singer Y, Srebro N, Cotter A
 "Pegasos: Primal Estimated Sub-Gradient Solver for SVM"
 Mathematical Programming, 2011.
 
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Protobuf serialization version.

    Fields inherited from class org.tribuo.Model

    ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutput

    Fields inherited from interface org.tribuo.protos.ProtoSerializable

    DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
  • Method Summary

    Modifier and Type
    Method
    Description
    protected KernelSVMModel
    copy(String newName, org.tribuo.provenance.ModelProvenance newProvenance)
     
    deserializeFromProto(int version, String className, com.google.protobuf.Any message)
    Deserialization factory.
    Optional<org.tribuo.Excuse<Label>>
    getExcuse(org.tribuo.Example<Label> example)
     
    int
    Returns the number of support vectors used.
    Map<String, List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>>
     
    org.tribuo.Prediction<Label>
    predict(org.tribuo.Example<Label> example)
     
    org.tribuo.protos.core.ModelProto
     

    Methods inherited from class org.tribuo.Model

    castModel, copy, createDataCarrier, deserialize, deserializeFromFile, deserializeFromStream, generatesProbabilities, getExcuses, getFeatureIDMap, getName, getOutputIDInfo, getProvenance, innerPredict, predict, predict, serializeToFile, serializeToStream, setName, toString, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • deserializeFromProto

      public static KernelSVMModel 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 the message.
    • getNumberOfSupportVectors

      Returns the number of support vectors used.
      Returns:
      The number of support vectors.
    • predict

      public org.tribuo.Prediction<Label> predict(org.tribuo.Example<Label> example)
      Specified by:
      predict in class org.tribuo.Model<Label>
    • getTopFeatures

      public Map<String, List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>> getTopFeatures(int n)
      Specified by:
      getTopFeatures in class org.tribuo.Model<Label>
    • getExcuse

      public Optional<org.tribuo.Excuse<Label>> getExcuse(org.tribuo.Example<Label> example)
      Specified by:
      getExcuse in class org.tribuo.Model<Label>
    • serialize

      public org.tribuo.protos.core.ModelProto serialize()
      Specified by:
      serialize in interface org.tribuo.protos.ProtoSerializable<org.tribuo.protos.core.ModelProto>
      Overrides:
      serialize in class org.tribuo.Model<Label>
    • copy

      protected KernelSVMModel copy(String newName, org.tribuo.provenance.ModelProvenance newProvenance)
      Specified by:
      copy in class org.tribuo.Model<Label>