category
feature_scoring_common
Shared arithmetic, discretization, and sparse contingency helpers for feature scoring.
logtalk_load(feature_selection_protocols(loader))staticPublic predicates
(no local declarations; see entity ancestors if any)
Protected predicates
class_scatter/5
Computes scaled between-class and within-class scatter from complete numeric-value and categorical-target pairs. Empty inputs have zero scatter.
staticclass_scatter(Pairs,ObservationCount,ClassCount,Between,Within)class_scatter(+list(pair),-non_negative_integer,-non_negative_integer,-float,-float) - onecategorical_pairs/4
Validates aligned scoring inputs and prepares complete categorical pairs, optionally discretizing numeric features.
staticcategorical_pairs(Discretization,Values,Targets,Pairs)categorical_pairs(+term,+list,+list,-list(pair)) - one_or_errorinstantiation_errortype_error(list,Input)type_error(atomic,Value)type_error(number,Value)type_error(integer,Count)domain_error(positive_integer,Count)domain_error(discretization,Discretization)consistency_error(list_length,ValueCount,TargetCount)contingency_counts/2
Builds sparse observed cell counts and marginal dictionaries from complete categorical pairs.
staticcontingency_counts(Pairs,Counts)contingency_counts(+list(pair),-compound) - onecontingency_min_expected_count/2
Returns the minimum expectation over occupied marginal categories, including unobserved cells. Empty tables return 0.0.
staticcontingency_min_expected_count(Counts,Minimum)contingency_min_expected_count(+compound,-float) - onecontingency_score/3
Computes mutual information, raw or Yates-corrected chi-square, symmetrical uncertainty, or uncorrected or bias-corrected Cramer’s V from sparse contingency counts. Degenerate tables score 0.0.
staticcontingency_score(Criterion,Counts,Score)contingency_score(+atom,+compound,-float) - onecomplete_pairs/3
Collects the Value-Target pairs for which both the feature value and the target are bound, discarding any example where either is an unbound variable (casewise deletion). Values and Targets must have the same length.
staticcomplete_pairs(Values,Targets,Pairs)complete_pairs(+list,+list,-list(pair)) - onecomplete_values/2
Collects the bound (non-missing) values of a list, discarding unbound ones.
staticcomplete_values(Values,Complete)complete_values(+list,-list(number)) - onemean_values/2
Computes the arithmetic mean of a non-empty numeric list.
staticmean_values(Values,Mean)mean_values(+list(number),-float) - one_or_errorValues is empty:evaluation_error(zero_divisor)variance_values/2
Computes the population variance of a non-empty numeric list.
staticvariance_values(Values,Variance)variance_values(+list(number),-float) - one_or_errorValues is empty:evaluation_error(zero_divisor)centered_values/2
Centers non-empty numeric values using offsets from the first value, preserving exact constant inputs.
staticcentered_values(Values,Centered)centered_values(+list(number),-list(number)) - one_or_errorValues is empty:evaluation_error(zero_divisor)scale_values/2
Scales numeric values by their largest absolute value, leaving an all-zero list unchanged.
staticscale_values(Values,Scaled)scale_values(+list(number),-list(number)) - onescale_values/3
Scales numeric values and returns the divisor, using 1.0 for an all-zero or empty list.
staticscale_values(Values,Scaled,Scale)scale_values(+list(number),-list(number),-number) - onesquared_deviations/3
Computes the squared deviation of every value from a given reference value (typically the mean).
staticsquared_deviations(Values,Reference,SquaredDeviations)squared_deviations(+list(number),+number,-list(number)) - onesum_of_squared_deviations/3
Computes the sum of the squared deviations of every value from a given reference value (typically the mean); the within-group sum of squares used by anova_f_score is the sum of this over every group.
staticsum_of_squared_deviations(Values,Reference,SumSquaredDeviations)sum_of_squared_deviations(+list(number),+number,-float) - onecenter/3
Subtracts a value (typically the mean) from every element of a numeric list.
staticcenter(Values,Value,Centered)center(+list(number),+number,-list(number)) - onedot_product/3
Computes the dot product of two position-aligned numeric lists of the same length.
staticdot_product(Values1,Values2,Dot)dot_product(+list(number),+list(number),-number) - onesum_of_squares_list/2
Computes the sum of the squares of a numeric list.
staticsum_of_squares_list(Values,SumSquares)sum_of_squares_list(+list(number),-number) - onesplit_pairs/3
Splits a list of Value1-Value2 pairs into separate, position-aligned lists of first and second values.
staticsplit_pairs(Pairs,Values1,Values2)split_pairs(+list(pair),-list(number),-list(number)) - onegroup_by_target/2
Groups Value-Target pairs into Target-Values pairs in standard target order, preserving input value order within each group.
staticgroup_by_target(Pairs,Groups)group_by_target(+list(pair),-list(pair)) - onePrivate predicates
compare_numeric_pairs/3
Compares numeric feature values arithmetically, keeping numerically equal representations together.
staticcompare_numeric_pairs(Order,Pair1,Pair2)compare_numeric_pairs(-atom,+pair,+pair) - oneOperators
(none)