Class MultinomialNaiveBayesModel
java.lang.Object
org.tribuo.Model<Label>
org.tribuo.classification.mnb.MultinomialNaiveBayesModel
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<org.tribuo.provenance.ModelProvenance>,Serializable,org.tribuo.protos.ProtoSerializable<org.tribuo.protos.core.ModelProto>
A
Model for multinomial Naive Bayes with Laplace smoothing.
All feature values must be non-negative, otherwise it will throw IllegalArgumentException.
See:
Wang S, Manning CD. "Baselines and Bigrams: Simple, Good Sentiment and Topic Classification" Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics, 2012.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.Fields inherited from class org.tribuo.Model
ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutputFields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Method Summary
Modifier and TypeMethodDescriptionprotected MultinomialNaiveBayesModelstatic MultinomialNaiveBayesModeldeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.getTopFeatures(int n) org.tribuo.Prediction<Label> org.tribuo.protos.core.ModelProtoMethods 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
-
Field Details
-
CURRENT_VERSION
-
-
Method Details
-
deserializeFromProto
public static MultinomialNaiveBayesModel 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
-
getExcuse
-
copy
protected MultinomialNaiveBayesModel copy(String newName, org.tribuo.provenance.ModelProvenance newProvenance) - Specified by:
copyin classorg.tribuo.Model<Label>
-
serialize
-