package oml

  1. Overview
  2. Docs

A generative classifier builds models of the form P(class, feature).

For current purposes these classifiers can return individual probabilities of the form P(feature | class).

include Classifier
include Input_interfaces.Data
type class_
type feature
include Oml_util.Optional_arg_intf
type opt
val default : opt
type t

The classifier.

val eval : t -> feature -> class_ Probabilities.t

eval classifier feature assign probabilities to the possible classes based upon feature.

type samples = (class_ * feature) list

Representing training data.

val estimate : ?opt:opt -> ?classes:class_ list -> samples -> t

estimate opt classes samples estimates a classifier based upon the training samples.

classes is an optional argument to specify ahead of time the possible classes to train on (defaults to the ones found in the training data). This is useful for models where we know the population domain but may not see an example of a training datum for rare cases.

opt are the optional classifier dependent estimation/evaluation arguments.

  • raises Invalid_argument

    if classes are specified and new ones are found in the training samples.

  • raises Invalid_argument

    if samples is empty.

type feature_probability
val class_probabilities : t -> class_ -> float * (feature -> feature_probability)

class_probabilities t class returns the prior and per feature likelihood probability (ies) learned by t for class.

  • raises Not_found

    if t never trained on class.


Innovation. Community. Security.