diff --git a/howso/react_discriminative.amlg b/howso/react_discriminative.amlg index eb19a12a..02df0aaf 100644 --- a/howso/react_discriminative.amlg +++ b/howso/react_discriminative.amlg @@ -651,12 +651,18 @@ ;else it is categorical feature, pull the categorical value with the highest weight sum from nearby cases (let - ;an assoc of categorical action feature values -> sum of their weight (assoc - categorical_value_weights_map (assoc) - output_value (null) + ;an assoc of categorical action feature values -> sum of their weight + categorical_value_weights_map + ;iterate over all the nearby cases, to create the mapping between each categorical action value and its summed + ;weight for this categorical feature. for each unique categorical value in all the neighbors, sum up its weight if + ;it's encountered more than once, and select the categorical value with the highest weight below + (zip + (lambda (+ (current_value 1) (current_value))) + candidate_case_values + candidate_case_weights + ) ) - (if output_influence_weights (call !AccumulateInfluenceWeights (assoc case_ids candidate_case_ids @@ -664,18 +670,6 @@ )) ) - ;iterate over all the nearby cases, to create the mapping between each categorical action value and its summed - ;weight for this categorical feature. for each unique categorical value in all the neighbors, sum up its weight if - ;it's encountered more than once, and select the categorical value with the highest weight below - (assign (assoc - categorical_value_weights_map - (zip - (lambda (+ (current_value 1) (current_value))) - candidate_case_values - candidate_case_weights - ) - )) - (if output_categorical_action_probabilities (call !AccumulateCategoricalActionProbabilties (assoc action_feature action_feature diff --git a/howso/train.amlg b/howso/train.amlg index 09ac51cd..649fb431 100644 --- a/howso/train.amlg +++ b/howso/train.amlg @@ -752,7 +752,9 @@ ;split by batches of cases until next analyze (while (< input_case_index (size cases)) - (if (and thresholds_enabled (not skip_ablation)) + ;Only compute prediction stats for ablation if thresholds are enabled, we're + ; not skipping ablation, and we have hyperparameters to use for the computation. + (if (and thresholds_enabled (not skip_ablation) (size !hyperparameterMetadataMap)) (seq (assign (assoc prev_prediction_stats_map new_prediction_stats_map @@ -836,6 +838,7 @@ (and (>= (+ !dataMassChangeSinceLastDataReduction batch_size) !autoAblationMaxNumCases) (not skip_reduce_data) + (size !hyperparameterMetadataMap) ) (call reduce_data (assoc abs_threshold_map !autoAblationAbsThresholdMap @@ -879,8 +882,12 @@ (let (assoc indices_to_train - (if thresholds_satisfied - ;If one or more thresholds has been satisfied, just train all of the cases in this batch. + ;If one or more thresholds has been satisfied, or the Trainee has not yet been analyzed, + ; just train all of the cases in this batch. + (if (or + thresholds_satisfied + (not (size !hyperparameterMetadataMap)) + ) (indices cases) ;Otherwise, do the normal ablation filtering. ||(filter @@ -1031,12 +1038,14 @@ (accum_to_entities (assoc !dataMassChangeSinceLastAnalyze mass_to_accumulate)) - ;recompute influence weights entropy - (call !ComputeAndStoreInfluenceWeightEntropies (assoc - features features - weight_feature accumulate_weight_feature - use_case_weights (true) - )) + ;recompute influence weights entropy only after we've analyzed. + (if (size !hyperparameterMetadataMap) + (call !ComputeAndStoreInfluenceWeightEntropies (assoc + features features + weight_feature accumulate_weight_feature + use_case_weights (true) + )) + ) ) ) diff --git a/unit_tests/ut_h_basic_ablation.amlg b/unit_tests/ut_h_basic_ablation.amlg index 601bfb64..b3c84867 100644 --- a/unit_tests/ut_h_basic_ablation.amlg +++ b/unit_tests/ut_h_basic_ablation.amlg @@ -2,8 +2,13 @@ #unit_test (direct_assign_to_entities (assoc unit_test (load "unit_test.amlg"))) (call (load "unit_test_howso.amlg") (assoc name "ut_h_basic_ablation.amlg")) + ;Set a non-default hyperparameter map since ablation checks for non-default + ; hyperparameters. (call_entity "howso" "set_params" (assoc - default_hyperparameter_map (assoc "k" 2 "p" 0.4 "dt" -1) + hyperparameter_map + {targetless { "A.B.C.D.E." { ".none" + {k 2 p 0.4 dt -1} + }}} )) (declare (assoc @@ -91,7 +96,6 @@ obs (call !get_num_cases) )) - (print "conviction value of new case: " (call_entity "howso" "react_group" (assoc features (append context_features action_features ) new_cases (list (list (list 1 2 1 3 3)))) ) "\n" ) diff --git a/unit_tests/ut_h_reduce_data.amlg b/unit_tests/ut_h_reduce_data.amlg index 30e9527a..95aff298 100644 --- a/unit_tests/ut_h_reduce_data.amlg +++ b/unit_tests/ut_h_reduce_data.amlg @@ -158,7 +158,7 @@ features (append context_labels action_labels) cases training_data session "iris_session" - skip_auto_analyze (true) + skip_auto_analyze (false) )) (call_entity "howso" "analyze" (assoc use_case_weights (true) diff --git a/version.json b/version.json index 7618acbe..bc76186e 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "version": "0.0.0", "dependencies": { - "amalgam": "58.1.1" + "amalgam": "58.1.2" } }