From 8dd5df80e05bc04010a435ff23205ac0fb0fa97a Mon Sep 17 00:00:00 2001 From: howsoRes <144272317+howsoRes@users.noreply.github.com> Date: Thu, 27 Aug 2026 11:43:47 -0400 Subject: [PATCH 1/3] 25902: Adds 'computed' flag to any internally computed features, MINOR --- module/attributes.amlg | 14 +++++++----- module/conviction.amlg | 6 ++--- module/generate_features.amlg | 8 +++++++ module/types.amlg | 5 +++++ unit_tests/ut_h_react_into_features.amlg | 14 ++++++------ unit_tests/ut_h_time_series_stock.amlg | 28 ++++++++++++++++++++++++ 6 files changed, 59 insertions(+), 16 deletions(-) diff --git a/module/attributes.amlg b/module/attributes.amlg index 1ff6df293..d1b3517ac 100644 --- a/module/attributes.amlg +++ b/module/attributes.amlg @@ -583,18 +583,20 @@ (modify (current_value) ["auto_derive_on_train" "code_features"] - (call !FeaturesInCustomCode (assoc - code_string (get (current_value 1) ["auto_derive_on_train" "code"]) - )) + (call !FeaturesInCustomCode (assoc + code_string (get (current_value 1) ["auto_derive_on_train" "code"]) + )) + ["computed"] + .true ) (contains_index (current_value) "derived_feature_code") (modify (current_value) "code_features" - (call !FeaturesInCustomCode (assoc - code_string (get (current_value 1) "derived_feature_code") - )) + (call !FeaturesInCustomCode (assoc + code_string (get (current_value 1) "derived_feature_code") + )) ) ) (current_value) diff --git a/module/conviction.amlg b/module/conviction.amlg index 5d861bdfc..a8cc51b3c 100644 --- a/module/conviction.amlg +++ b/module/conviction.amlg @@ -260,17 +260,17 @@ (map (lambda (if (or (= "p_value_of_addition" (current_value)) (= "p_value_of_removal" (current_value))) - {"type" "continuous" "data_type" "number" "bounds" {"min" 0 "max" 1} } + {"type" "continuous" "data_type" "number" "bounds" {"min" 0 "max" 1} "computed" .true } ;else convictions, entropy and distance contribution ranges are 0 to infinity - {"type" "continuous" "data_type" "number" "bounds" {"min" 0 "max" .infinity} } + {"type" "continuous" "data_type" "number" "bounds" {"min" 0 "max" .infinity} "computed" .true } ) ) (indices computed_map) ) ) (if clustering - (associate clustering {"type" "nominal" "data_type" "number" }) + (associate clustering {"type" "nominal" "data_type" "number" "computed" .true }) {} ) ) diff --git a/module/generate_features.amlg b/module/generate_features.amlg index a99ac009f..503f45d1c 100644 --- a/module/generate_features.amlg +++ b/module/generate_features.amlg @@ -785,6 +785,7 @@ "bounds" (assoc "min" 0.0 "allow_null" .false) "decimal_places" 0 "original_type" {"data_type" "integer" "size" 8} + "computed" .true ) ".synchronous_counter_lag_1" (assoc @@ -795,6 +796,7 @@ "derived_feature_code" "(call value {feature \".synchronous_counter\" lag 1})" "ts_type" "lag" "parent" ".synchronous_counter" + "computed" .true ) ".series_index" (assoc @@ -803,6 +805,7 @@ "original_type" {"data_type" "integer" "size" 8} "derived_feature_code" "(+ 1 (call value {feature \".series_index\" lag 1}))" "bounds" (assoc "min" 0.0 "allow_null" .false) + "computed" .true ) ".reverse_series_index" (assoc @@ -810,6 +813,7 @@ "decimal_places" 0 "original_type" {"data_type" "integer" "size" 8} "bounds" (assoc "min" 0.0 "allow_null" .false) + "computed" .true ) ) )) @@ -824,6 +828,7 @@ "derived_feature_code" "(call value {feature \".time_to_horizon\" lag 1})" "bounds" (assoc "min" 0.0 "allow_null" .false) "original_type" {"data_type" "numeric" "size" 8} + "computed" .true ) ) )) @@ -922,6 +927,7 @@ ;internal sub-attributed used to identify time series type of parent feature "parent_type" (get attributes (list "time_series" "type")) "parent" feature + "computed" .true ) (if date_time_format (assoc "date_time_format" date_time_format) @@ -982,6 +988,7 @@ "ts_order" (current_index 1) "parent" feature "original_type" {"data_type" "numeric" "size" 8} + "computed" .true ) ;if order <= derived_orders, set the derived_feature_code property @@ -1035,6 +1042,7 @@ "ts_order" (current_index 1) "parent" feature "original_type" {"data_type" "numeric" "size" 8} + "computed" .true ) ;if order <= derived_orders, set the derived_feature_code property diff --git a/module/types.amlg b/module/types.amlg index 63e864409..58c0f2b13 100644 --- a/module/types.amlg +++ b/module/types.amlg @@ -188,6 +188,11 @@ values "string" description "A list of features needed to derive code" ) + computed + (assoc + type "boolean" + description "Flag, set to true if this feature was computed internally and not explicitly trained with the original dataset." + ) post_process (assoc type "string" diff --git a/unit_tests/ut_h_react_into_features.amlg b/unit_tests/ut_h_react_into_features.amlg index 32bf91402..7d6c909f5 100644 --- a/unit_tests/ut_h_react_into_features.amlg +++ b/unit_tests/ut_h_react_into_features.amlg @@ -114,13 +114,13 @@ exp { color {type "nominal"} - ".distance_contribution" { bounds {max .infinity min 0} data_type "number" type "continuous" } - dc { bounds {max .infinity min 0} data_type "number" type "continuous" } - fc { bounds {max .infinity min 0} data_type "number" type "continuous" } - if { bounds {max .infinity min 0} data_type "number" type "continuous" } - sc { bounds {max .infinity min 0} data_type "number" type "continuous" } - rc { bounds {max .infinity min 0} data_type "number" type "continuous" } - ".similarity_conviction" { bounds {max .infinity min 0} data_type "number" type "continuous" } + ".distance_contribution" { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + dc { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + fc { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + if { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + sc { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + rc { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} + ".similarity_conviction" { bounds {max .infinity min 0} data_type "number" type "continuous" computed .true} x { bounds {allow_null .true} type "continuous" } y { bounds {allow_null .true} type "continuous" } } diff --git a/unit_tests/ut_h_time_series_stock.amlg b/unit_tests/ut_h_time_series_stock.amlg index b9b57b088..a3cc6ab68 100644 --- a/unit_tests/ut_h_time_series_stock.amlg +++ b/unit_tests/ut_h_time_series_stock.amlg @@ -117,6 +117,34 @@ start_index 20 )) + (assign (assoc + result (call_entity "howso" "get_feature_attributes") + )) + (call keep_result_payload) + (print "Computed flag set for all computed features only: ") + (call assert_true (assoc + obs + (first (values + (map + (lambda + ;all the built-in ts features are computed + (if (= "." (first (current_index))) + (get (current_value) "computed") + + ;the custom defined feature is computed + (= "over106" (current_index)) + (get (current_value) "computed") + + ;trained features are not computed + (not (contains_index (current_value) "computed")) + ) + ) + result + ) + .true + )) + )) + (print "specified start_index on second train batch works:\n") ;the 17th case should have training index 20 (call assert_same (assoc From f8a6986d754065ffa78223633751aa3aeca8923e Mon Sep 17 00:00:00 2001 From: howsoRes <144272317+howsoRes@users.noreply.github.com> Date: Thu, 27 Aug 2026 13:25:18 -0400 Subject: [PATCH 2/3] docstring --- module/attributes.amlg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/attributes.amlg b/module/attributes.amlg index d1b3517ac..cb40f7192 100644 --- a/module/attributes.amlg +++ b/module/attributes.amlg @@ -119,6 +119,8 @@ ; 'value_evaluation_code': string, custom Amalgam code that is called to return the value used for the feature in distance computations. ; The code should either be a singular (call_on_entity) or (call_entity) with the entity specified as .null. ; + ; 'computed': boolean, automatically set to true for any internally computed feature that was not trained from the original dataset + ; ; 'non_sensitive': boolean, flag a categorical nominal feature as non-sensitive. It is recommended that ; all nominal features be represented with either an 'int-id' subtype or another ; available nominal subtype using the 'subtype' attribute. However, if the nominal From aa8fb98095ed1f20aeb21f6c10bbe059b52f0e2a Mon Sep 17 00:00:00 2001 From: howsoRes <144272317+howsoRes@users.noreply.github.com> Date: Thu, 27 Aug 2026 13:31:05 -0400 Subject: [PATCH 3/3] fix test per comment --- unit_tests/ut_h_time_series_stock.amlg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unit_tests/ut_h_time_series_stock.amlg b/unit_tests/ut_h_time_series_stock.amlg index a3cc6ab68..74fe08009 100644 --- a/unit_tests/ut_h_time_series_stock.amlg +++ b/unit_tests/ut_h_time_series_stock.amlg @@ -122,9 +122,10 @@ )) (call keep_result_payload) (print "Computed flag set for all computed features only: ") - (call assert_true (assoc + (call assert_same (assoc + exp [.true] obs - (first (values + (values (map (lambda ;all the built-in ts features are computed @@ -142,7 +143,7 @@ result ) .true - )) + ) )) (print "specified start_index on second train batch works:\n")