protocol

# `classifier_protocol`

Protocol for machine learning classifiers.

Availability:
`logtalk_load(classifier_protocols(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-02-19
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `learn/2`

Learns a classifier from the given dataset object.

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`

### `classifier_to_clauses/4`

Converts a classifier into a list of predicate clauses. `Functor` is the functor for the generated predicate clauses.

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

### `classifier_to_file/4`

Exports a classifier to a file. `Functor` is the functor for the generated predicate clauses.

Compilation flags:
`static`
Template:
`classifier_to_file(Dataset,Classifier,Functor,File)`
Mode and number of proofs:
`classifier_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

c45, isolation_forest, knn, naive_bayes, nearest_centroid, random_forest