Nasty.AST.ClassificationModel (Nasty v0.3.0)

View Source

Classification model containing learned parameters for prediction.

Stores the trained model parameters including class priors, feature probabilities, and vocabulary for making predictions on new documents.

Summary

Types

Classification algorithm type.

t()

Functions

Creates a new classification model.

Checks if the model has been trained (has learned parameters).

Types

algorithm()

@type algorithm() :: :naive_bayes | :svm | :logistic_regression

Classification algorithm type.

t()

@type t() :: %Nasty.AST.ClassificationModel{
  algorithm: algorithm(),
  class_priors: %{required(atom()) => float()},
  classes: [atom()],
  feature_probs: %{required(atom()) => %{required(any()) => float()}},
  metadata: map(),
  vocabulary: MapSet.t()
}

Functions

new(algorithm, classes, opts \\ [])

@spec new(algorithm(), [atom()], keyword()) :: t()

Creates a new classification model.

Examples

iex> model = Nasty.AST.ClassificationModel.new(:naive_bayes, [:spam, :ham])
iex> model.algorithm
:naive_bayes
iex> model.classes
[:spam, :ham]

trained?(arg1)

@spec trained?(t()) :: boolean()

Checks if the model has been trained (has learned parameters).

Examples

iex> model = Nasty.AST.ClassificationModel.new(:naive_bayes, [:spam, :ham])
iex> Nasty.AST.ClassificationModel.trained?(model)
false