protocol

# `regressor_protocol`

Protocol for machine learning regressors.

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

## Public predicates

### `learn/3`

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

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

### `learn/2`

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

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

### `predict/3`

Predicts the numeric target value for a new instance using the learned regressor. The instance is a list of `Attribute-Value` pairs.

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

### `check_regressor/1`

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

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

### `valid_regressor/1`

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

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

### `diagnostics/2`

Returns diagnostics metadata for a learned regressor.

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

### `diagnostic/2`

Enumerates individual diagnostics metadata terms for a learned regressor.

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

### `regressor_options/2`

Returns the effective options stored in a learned regressor diagnostics metadata.

Compilation flags:
`static`
Template:
`regressor_options(Regressor,Options)`
Mode and number of proofs:
`regressor_options(+compound,-list(compound))` - `one`

### `export_to_clauses/4`

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

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

### `export_to_file/4`

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

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

### `print_regressor/1`

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

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

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)

See also

linear_regression, regression_dataset_protocol