classifier_protocol — Logtalk 3.100.1

protocol

# `classifier_protocol`

Protocol for machine learning classifiers.

Availability:
`logtalk_load(classification_protocols(loader))`
Author: Paulo Moura
Version: 2:0:0
Date: 2026-05-07
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `learn/3`

Learns a classifier from the given dataset object using the specified options.

Compilation flags:
`static`
Template:
`learn(Dataset,Classifier,Options)`
Mode and number of proofs:
`learn(+object_identifier,-compound,+list(compound))` - `one`

### `learn/2`

Learns a classifier from the given dataset object using default options.

Compilation flags:
`static`
Template:
`learn(Dataset,Classifier)`
Mode and number of proofs:
`learn(+object_identifier,-compound)` - `one`

### `predict/3`

Predicts the class label for a new instance using the learned classifier. The instance is a list of `Attribute-Value` pairs.

Compilation flags:
`static`
Template:
`predict(Classifier,Instance,Class)`
Mode and number of proofs:
`predict(+compound,+list,-atom)` - `one`

### `check_classifier/1`

Checks that a learned classifier term is structurally valid for the receiving implementation. Throws an exception when the term is not a valid classifier representation.

Compilation flags:
`static`
Template:
`check_classifier(Classifier)`
Mode and number of proofs:
`check_classifier(@compound)` - `one_or_error`
Exceptions:
`Classifier` is a variable:
`instantiation_error`
`Classifier` is neither a variable nor a valid classifier:
`domain_error(classifier,Classifier)`

### `valid_classifier/1`

True when a learned classifier term is structurally valid for the receiving implementation. Succeeds iff `check_classifier/1` succeeds without throwing an exception.

Compilation flags:
`static`
Template:
`valid_classifier(Classifier)`
Mode and number of proofs:
`valid_classifier(@compound)` - `zero_or_one`

### `diagnostics/2`

Returns diagnostics and metadata associated with a learned classifier in a representation-independent way.

Compilation flags:
`static`
Template:
`diagnostics(Classifier,Diagnostics)`
Mode and number of proofs:
`diagnostics(+compound,-list(compound))` - `one`

### `diagnostic/2`

Tests or enumerates individual diagnostics metadata terms for a learned classifier.

Compilation flags:
`static`
Template:
`diagnostic(Classifier,Diagnostic)`
Mode and number of proofs:
`diagnostic(+compound,?compound)` - `zero_or_more`

### `classifier_options/2`

Returns the effective training options recorded in a learned classifier diagnostics list.

Compilation flags:
`static`
Template:
`classifier_options(Classifier,Options)`
Mode and number of proofs:
`classifier_options(+compound,-list(compound))` - `zero_or_one`

### `export_to_clauses/4`

Converts a classifier into a list of predicate clauses. `Functor` is the functor for the generated predicate clauses. When exporting a serialized classifier term, a noun such as `classifier` or `model` is usually clearer than a verb such as `classify`.

Compilation flags:
`static`
Template:
`export_to_clauses(Dataset,Classifier,Functor,Clauses)`
Mode and number of proofs:
`export_to_clauses(+object_identifier,+compound,+callable,-list(clause))` - `one`

### `export_to_file/4`

Exports a classifier to a file. `Functor` is the functor for the generated predicate clauses. When exporting a serialized classifier term, a noun such as `classifier` or `model` is usually clearer than a verb such as `classify`.

Compilation flags:
`static`
Template:
`export_to_file(Dataset,Classifier,Functor,File)`
Mode and number of proofs:
`export_to_file(+object_identifier,+compound,+callable,+atom)` - `one`

### `print_classifier/1`

Prints a classifier to the current output stream in a human-readable format.

Compilation flags:
`static`
Template:
`print_classifier(Classifier)`
Mode and number of proofs:
`print_classifier(+compound)` - `one`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)

See also

adaptive_boosting_classifier, c45_classifier, gradient_boosting_classifier, isolation_forest_anomaly_detector, kernel_svm_classifier, knn_classifier, lda_classifier, linear_svm_classifier, logistic_regression_classifier, naive_bayes_classifier, nearest_centroid_classifier, qda_classifier, random_forest_classifier, sgd_classifier