object

c45_classifier

C4.5 decision tree learning algorithm. Builds a decision tree from a dataset object implementing the dataset_protocol protocol and provides predicates for exporting the learned tree as a list of predicate clauses or to a file. Supports both discrete and continuous attributes, handles missing values, and supports tree pruning.

Availability:
logtalk_load(c45_classifier(loader))
Author: Paulo Moura
Version: 3:0:0
Date: 2026-10-13
Compilation flags:
static, context_switching_calls
Remarks:
(none)

Public predicates

prune/5

Prunes a decision tree using pessimistic error pruning (PEP). This post-pruning method estimates error rates using the upper confidence bound of the binomial distribution with the given confidence factor and replaces subtrees with leaf nodes when doing so would not increase the estimated error. Pruning helps reduce overfitting and can improve generalization to unseen data.

Compilation flags:
static
Template:
prune(Dataset,Tree,ConfidenceFactor,MinInstances,PrunedTree)
Mode and number of proofs:
prune(+object_identifier,+classifier,+float,+positive_integer,-classifier) - one
Exceptions:
An input parameter or tree is a variable:
instantiation_error
Confidence factor is not a float in (0.0, 0.5]:
domain_error(confidence_factor,ConfidenceFactor)
Minimum instances is not a positive integer:
domain_error(positive_integer,MinInstances)
Tree is invalid:
domain_error(classifier,Tree)
Dataset is empty:
domain_error(non_empty_dataset,Dataset)
Dataset class values are invalid:
domain_error(class_values,ClassValues)
Dataset attribute declarations are invalid:
domain_error(attribute_declarations,Attribute)
A required attribute binding is missing:
existence_error(attribute,Attribute)
Remarks:
  • Confidence factor: The confidence factor must be a float in (0.0, 0.5] so that the error estimate is an upper confidence bound. Lower values increase the estimated uncertainty. The default value is 0.25.

  • Minimum node population: A non-empty node with weighted population below this positive integer is replaced by its majority leaf. This does not require every leaf to meet the minimum. The default value is 2.

  • Statistical basis: The pruning uses the upper confidence bound of the binomial distribution to estimate the true error rate.


prune/3

Prunes a decision tree using pessimistic error pruning (PEP) with default parameter values. Calls prune/5 with ConfidenceFactor = 0.25 and MinInstances = 2.

Compilation flags:
static
Template:
prune(Dataset,Tree,PrunedTree)
Mode and number of proofs:
prune(+object_identifier,+classifier,-classifier) - one
Exceptions:
Tree is a variable:
instantiation_error
Tree is invalid:
domain_error(classifier,Tree)
Dataset is empty:
domain_error(non_empty_dataset,Dataset)
Dataset class values are invalid:
domain_error(class_values,ClassValues)
Dataset attribute declarations are invalid:
domain_error(attribute_declarations,Attribute)
A required attribute binding is missing:
existence_error(attribute,Attribute)
Remarks:
  • Default parameters: Uses a confidence factor of 0.25 and minimum weighted node population of 2. Existing leaves and empty branches are preserved.


Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)