classifier_common — Logtalk 3.100.1

category

# `classifier_common`

Shared predicates for classifier diagnostics, dataset validation, mixed-feature distance calculations, and export.

Availability:
`logtalk_load(classification_protocols(loader))`
Author: Paulo Moura
Version: 2:0:0
Date: 2026-05-11
Compilation flags:
`static`
Implements:
`public` classifier_protocol
Extends:
`public` options
Uses:
format
list
population
type
Remarks:
(none)
Inherited public predicates:
check_classifier/1 check_option/1 check_options/1 classifier_options/2 default_option/1 default_options/1 diagnostic/2 diagnostics/2 export_to_clauses/4 export_to_file/4 learn/2 learn/3 option/2 option/3 predict/3 print_classifier/1 valid_classifier/1 valid_option/1 valid_options/1

## Public predicates

(no local declarations; see entity ancestors if any)

## Protected predicates

### `classifier_diagnostics_data/2`

Hook predicate that importing classifier implementations must define in order to expose diagnostics metadata.

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

### `classifier_export_template/4`

Hook predicate that importing classifier implementations must define in order to expose the exported classifier template for a given functor.

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

### `classifier_term_template/2`

Hook predicate that importing classifier implementations must define in order to expose the learned classifier term template used by pretty-printing helpers.

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

### `print_classifier_template/1`

Pretty-printing helper predicate used by importing classifier implementations to show the learned classifier term template.

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

### `valid_attribute_names/1`

True when a list of attribute names is a proper list of distinct atoms.

Compilation flags:
`static`
Template:
`valid_attribute_names(AttributeNames)`
Mode and number of proofs:
`valid_attribute_names(+list(atom))` - `zero_or_one`

### `valid_class_values/1`

True when a list of class values is a non-empty proper list of distinct atoms.

Compilation flags:
`static`
Template:
`valid_class_values(ClassValues)`
Mode and number of proofs:
`valid_class_values(+list(atom))` - `zero_or_one`

### `valid_feature_types/2`

True when a list of feature type tags is non-empty and each tag belongs to the given allowed set.

Compilation flags:
`static`
Template:
`valid_feature_types(FeatureTypes,AllowedTypes)`
Mode and number of proofs:
`valid_feature_types(+list,+list)` - `zero_or_one`

### `valid_discrete_values/1`

True when a list of categorical values is non-empty, contains only nonvar terms, and has no duplicates.

Compilation flags:
`static`
Template:
`valid_discrete_values(Values)`
Mode and number of proofs:
`valid_discrete_values(+list)` - `zero_or_one`

### `valid_linear_encoders/1`

True when a list of encoders only contains valid `continuous/3` or `categorical/2` encoder terms with distinct attributes.

Compilation flags:
`static`
Template:
`valid_linear_encoders(Encoders)`
Mode and number of proofs:
`valid_linear_encoders(+list(compound))` - `zero_or_one`

### `dataset_attributes/2`

Collects the declared dataset attributes and their value domains.

Compilation flags:
`static`
Template:
`dataset_attributes(Dataset,Attributes)`
Mode and number of proofs:
`dataset_attributes(+object_identifier,-list(pair))` - `one`

### `dataset_examples/2`

Collects the dataset training examples as `Id-Class-AttributeValues` terms.

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

### `check_examples_non_empty/2`

Checks that a training example collection is not empty.

Compilation flags:
`static`
Template:
`check_examples_non_empty(Dataset,Examples)`
Mode and number of proofs:
`check_examples_non_empty(+object_identifier,+list)` - `one`

### `check_examples/2`

Checks that a training dataset is non-empty, that all example classes belong to the declared class values, and that provided attribute bindings use declared attributes with values matching the declared domains. Missing attribute bindings are allowed.

Compilation flags:
`static`
Template:
`check_examples(Dataset,Examples)`
Mode and number of proofs:
`check_examples(+object_identifier,+list)` - `one_or_error`

### `check_complete_examples/2`

Checks that a training dataset is non-empty, that all example classes belong to the declared class values, and that each example contains every declared attribute exactly once with values matching the declared domains. Missing values represented using variables are allowed.

Compilation flags:
`static`
Template:
`check_complete_examples(Dataset,Examples)`
Mode and number of proofs:
`check_complete_examples(+object_identifier,+list)` - `one_or_error`

### `check_complete_examples_nonvar/2`

Checks that a training dataset is non-empty, that all example classes belong to the declared class values, and that each example contains every declared attribute exactly once with non-variable values matching the declared domains.

Compilation flags:
`static`
Template:
`check_complete_examples_nonvar(Dataset,Examples)`
Mode and number of proofs:
`check_complete_examples_nonvar(+object_identifier,+list)` - `one_or_error`

### `build_linear_encoders/4`

Builds linear-model encoders for continuous and categorical attributes. Continuous encoders optionally standardize features when `FeatureScaling` is true.

Compilation flags:
`static`
Template:
`build_linear_encoders(Attributes,Examples,FeatureScaling,Encoders)`
Mode and number of proofs:
`build_linear_encoders(+list(pair),+list(compound),+boolean,-list(compound))` - `one`

### `examples_to_linear_rows/3`

Encodes examples into `Features-Class` rows using the given linear encoders.

Compilation flags:
`static`
Template:
`examples_to_linear_rows(Examples,Encoders,Rows)`
Mode and number of proofs:
`examples_to_linear_rows(+list(compound),+list(compound),-list(pair))` - `one`

### `encode_linear_instance/3`

Encodes an instance into a numeric feature vector using the given linear encoders.

Compilation flags:
`static`
Template:
`encode_linear_instance(Encoders,Instance,Features)`
Mode and number of proofs:
`encode_linear_instance(+list(compound),+list(pair),-list(float))` - `one`

### `linear_encoders_feature_count/2`

Computes the number of numeric features produced by a set of linear encoders.

Compilation flags:
`static`
Template:
`linear_encoders_feature_count(Encoders,Count)`
Mode and number of proofs:
`linear_encoders_feature_count(+list(compound),-integer)` - `one`

### `valid_classifier_metadata/2`

True when diagnostics metadata contains the expected model term.

Compilation flags:
`static`
Template:
`valid_classifier_metadata(Model,Diagnostics)`
Mode and number of proofs:
`valid_classifier_metadata(+atom,+list(compound))` - `zero_or_one`

### `valid_classifier_metadata/3`

True when diagnostics metadata contains the expected model term and records the given effective options.

Compilation flags:
`static`
Template:
`valid_classifier_metadata(Model,Options,Diagnostics)`
Mode and number of proofs:
`valid_classifier_metadata(+atom,+list(compound),+list(compound))` - `zero_or_one`

### `mixed_feature_distance/5`

Computes a distance between two mixed-feature vectors using the given feature types and one of the supported metrics `euclidean`, `manhattan`, `chebyshev`, `cosine`, or `minkowski(Order)`.

Compilation flags:
`static`
Template:
`mixed_feature_distance(Metric,FeatureTypes,Values1,Values2,Distance)`
Mode and number of proofs:
`mixed_feature_distance(+term,+list,+list,+list,-float)` - `one_or_error`

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)