| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.100.1/docs/handbook/_sources/libraries/gradient_boosting_classifier.rst.txt |
.. _library_gradient_boosting_classifier:
gradient_boosting_classifierGradient boosting classifier for tabular datasets using multinomial additive models fitted by regression trees to softmax residuals. At each boosting stage the implementation fits one regression tree per class and updates additive class scores using the configured learning rate.
The library implements the classifier_protocol defined in the
classification_protocols library. It provides predicates for
learning a classifier from a dataset, using it to make predictions,
estimating class probabilities, and exporting it as a list of predicate
clauses or to a file.
Datasets are represented as objects implementing the
dataset_protocol protocol from the classification_protocols
library. Continuous, categorical, and mixed-feature datasets are
supported through the reused regression_tree backend.
Open the `../../docs/library_index.html#gradient_boosting_classifier <../../docs/library_index.html#gradient_boosting_classifier>`__ link in a web browser.
To load this library, load the loader.lgt file:
::
| ?- logtalk_load(gradient_boosting_classifier(loader)).
To test this library predicates, load the tester.lgt file:
::
| ?- logtalk_load(gradient_boosting_classifier(tester)).
regression_tree library to
fit residual models at each boosting stage.The learn/3 predicate supports these options:
25)0.1)3)1)0.0)false)Learning a classifier ~~~~~~~~~~~~~~~~~~~~~
::
| ?- gradient_boosting_classifier::learn(weather, Classifier).
| ?- gradient_boosting_classifier::learn(iris_small, Classifier, [number_of_estimators(50), learning_rate(0.05)]).
Making predictions ~~~~~~~~~~~~~~~~~~
::
| ?- gradient_boosting_classifier::learn(weather, Classifier),
gradient_boosting_classifier::predict(Classifier, [outlook-overcast, temperature-mild, humidity-high, windy-false], Class).
| ?- gradient_boosting_classifier::learn(mixed, Classifier),
gradient_boosting_classifier::predict_probabilities(Classifier, [age-40, income-60000, student-yes, credit_rating-fair], Probabilities).
Exporting the classifier ~~~~~~~~~~~~~~~~~~~~~~~~
::
| ?- gradient_boosting_classifier::learn(weather, Classifier),
gradient_boosting_classifier::export_to_clauses(weather, Classifier, classify, Clauses).
| ?- gradient_boosting_classifier::learn(weather, Classifier),
gradient_boosting_classifier::export_to_file(weather, Classifier, classify, 'classifier.pl').
The learned classifier is represented as a compound term with the form:
::
gradient_boosting_classifier(Classes, InitialScores, StageTrees, Options)
Where:
Classes: list of class labelsInitialScores: list of initial log-prior scores, one per classStageTrees: list of stage_trees(ClassTrees) terms, where each
ClassTrees value contains
class_tree(Class, LearningRate, Tree) termsOptions: merged training options used to learn the classifier
When exported using export_to_clauses/4 or export_to_file/4,
this classifier term is serialized directly as the single argument of
the generated predicate clause so that the exported model can be loaded
and reused as-is.