.. index:: single: lof_anomaly_detector .. _lof_anomaly_detector/0: .. rst-class:: right **object** ``lof_anomaly_detector`` ======================== Local Outlier Factor anomaly detector with multiple distance metrics, mixed-feature support, and missing-value handling. Learns from baseline training examples selected from a dataset object implementing the ``anomaly_dataset_protocol`` protocol and returns a detector term that can be used for scoring, prediction, and export. | **Availability:** | ``logtalk_load(lof_anomaly_detector(loader))`` | **Author:** Paulo Moura | **Version:** 2:0:1 | **Date:** 2026-11-11 | **Compilation flags:** | ``static, context_switching_calls`` | **Imports:** | ``public`` :ref:`anomaly_detector_common ` | **Uses:** | :ref:`avltree ` | :ref:`binary_heap_max ` | :ref:`format ` | :ref:`list ` | :ref:`numberlist ` | :ref:`pairs ` | :ref:`type ` | **Remarks:** | (none) | **Inherited public predicates:** |  :ref:`anomaly_detector_protocol/0::anomaly_detector_options/2`  :ref:`anomaly_detector_protocol/0::check_anomaly_detector/1`  :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`anomaly_detector_protocol/0::diagnostic/2`  :ref:`anomaly_detector_protocol/0::diagnostics/2`  :ref:`anomaly_detector_protocol/0::export_to_clauses/4`  :ref:`anomaly_detector_protocol/0::export_to_file/4`  :ref:`anomaly_detector_protocol/0::learn/2`  :ref:`anomaly_detector_protocol/0::learn/3`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`anomaly_detector_protocol/0::predict/3`  :ref:`anomaly_detector_protocol/0::predict/4`  :ref:`anomaly_detector_protocol/0::print_anomaly_detector/1`  :ref:`anomaly_detector_protocol/0::score/3`  :ref:`anomaly_detector_protocol/0::score_all/3`  :ref:`anomaly_detector_protocol/0::valid_anomaly_detector/1`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`   .. contents:: :local: :backlinks: top Public predicates ----------------- (no local declarations; see entity ancestors if any) Protected predicates -------------------- (no local declarations; see entity ancestors if any) Private predicates ------------------ .. index:: extract_values/3 .. _lof_anomaly_detector/0::extract_values/3: ``extract_values/3`` ^^^^^^^^^^^^^^^^^^^^ Extracts feature values in the declared attribute order. | **Compilation flags:** | ``static`` | **Template:** | ``extract_values(Attributes,AttributeValues,Values)`` | **Mode and number of proofs:** | ``extract_values(+list(atom),+list(pair),-list)`` - ``one_or_error`` | **Exceptions:** | A declared attribute is absent from ``AttributeValues``: | ``existence_error(attribute,Attribute)`` ------------ .. index:: check_feature_values/2 .. _lof_anomaly_detector/0::check_feature_values/2: ``check_feature_values/2`` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Checks prepared numeric, categorical, and missing feature values. | **Compilation flags:** | ``static`` | **Template:** | ``check_feature_values(FeatureTypes,Values)`` | **Mode and number of proofs:** | ``check_feature_values(+list(atom),+list)`` - ``one_or_error`` | **Exceptions:** | A bound feature value in ``Values`` is not a ground term: | ``instantiation_error`` | A numeric feature value is not a number: | ``type_error(number,Value)`` | A categorical feature value is not an atom: | ``type_error(atom,Value)`` ------------ .. index:: check_instance_ids/2 .. _lof_anomaly_detector/0::check_instance_ids/2: ``check_instance_ids/2`` ^^^^^^^^^^^^^^^^^^^^^^^^ Checks distinct integer identities for training examples. | **Compilation flags:** | ``static`` | **Template:** | ``check_instance_ids(Instances,Seen)`` | **Mode and number of proofs:** | ``check_instance_ids(+list,+list(integer))`` - ``one_or_error`` | **Exceptions:** | An example identifier in ``Instances`` is not a ground term: | ``instantiation_error`` | An example identifier is not an integer: | ``type_error(integer,Id)`` | An example identifier occurs more than once: | ``domain_error(unique_example_id,Id)`` ------------ Operators --------- (none) .. seealso:: :ref:`anomaly_dataset_protocol `, :ref:`anomaly_detector_protocol `, :ref:`knn_distance_anomaly_detector `, :ref:`isolation_forest_anomaly_detector `