Skip to content

Commit

Permalink
21467: Fixes bugs where lists are indexed via strings, which always r…
Browse files Browse the repository at this point in the history
…etrieved the first element (#317)
  • Loading branch information
cademack authored Oct 3, 2024
1 parent 8afe88a commit d48a245
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions howso/ablation.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@
;Use (current_index 2) and (current_index 1) to access the values in the prediction stats
; maps, which have the same structure as the threshold map.
(/
(-
(-
(get new_prediction_stats_map (list (current_index 2) (current_index 1)))
(get prev_prediction_stats_map (list (current_index 2) (current_index 1)))
)
(get prev_prediction_stats_map (list (current_index 2) (current_index 1)))
)
(- (/
(-
(-
(get new_prediction_stats_map (list (current_index 2) (current_index 1)))
(get prev_prediction_stats_map (list (current_index 2) (current_index 1)))
)
Expand Down Expand Up @@ -418,7 +418,7 @@
(call !GetCasesByCondition (assoc
condition
(associate
!internalLabelInfluenceWeightEntropy
!internalLabelInfluenceWeightEntropy
(list
(call !RecomputeAndCacheMaxInfluenceWeightEntropy (assoc
influence_weight_entropy_threshold influence_weight_entropy_threshold
Expand Down Expand Up @@ -486,7 +486,7 @@
))

(accum_to_entities (assoc !revision 1))
(call !Return (assoc
(call !Return (assoc
payload output
))
)
Expand Down Expand Up @@ -666,7 +666,7 @@
feature (current_index 1)
;flag set if this feature uses residual as its threshold type
ablate_by_feature_residuals
(contains_index (zip !autoAblationResidualPredictionFeatures) (current_index 1) )
(contains_value !autoAblationResidualPredictionFeatures (current_index 1))
)
(declare (assoc
context_features (filter (lambda (!= feature (current_value))) features)
Expand Down Expand Up @@ -752,12 +752,12 @@
min
(if (= threshold_type "tolerance")
(get !autoAblationTolerancePredictionThresholdMap (list action_feature 0))
(get residual_map (list (get action_features (current_index 1)) "min"))
(get residual_map (list action_feature "min"))
)
max
(if (= threshold_type "tolerance")
(get !autoAblationTolerancePredictionThresholdMap (list action_feature 1))
(get residual_map (list (get action_features (current_index 1)) "max"))
(get residual_map (list action_feature "max"))
)
)
(and (>= (current_value) (- action_value min)) (<= (current_value) (+ action_value max)))
Expand Down
2 changes: 1 addition & 1 deletion howso/update_cases.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
;closest_cases_map (current_value 1)
case_weight
(if (!= (null) weight_feature_index)
(get batch_of_cases [ (current_index 1) weight_feature_index ] )
(get batch_of_cases [ (current_index 2) weight_feature_index ] )
;assume weight of 1 if weight feature values are not given
1
)
Expand Down
8 changes: 4 additions & 4 deletions unit_tests/ut_h_analyze_feature_weights.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@
)
))
)
(get (current_value) (list 0 "action_values"))
(get (current_value) (list 1 "action_values"))
(first (current_value))
(last (current_value))
)
)
(get result (list 1 "payload" ))
(get result2 (list 1 "payload" ))
(get result (list 1 "payload" "action_values"))
(get result2 (list 1 "payload" "action_values"))
)
(print "Mismatches: " mismatches " out of " total_gen "\n")
(print "Batch react rand seeds provide consistent results: ")
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/ut_h_case_generation_preserving.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
)
))
(print "preserve feature value one feature given specific id: ")
(call assert_same (assoc obs (get result "id") exp 10))
(call assert_same (assoc obs (first result) exp 10))

(assign (assoc
result
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/ut_h_null_react.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@

(print "Analyzing a targeted inactive feature results in a targetless analyze: ")
(call assert_true (assoc
obs (contains_index result "There are no values to analyze for 'null_test', defaulting to 'targetless'.")
obs (contains_value result "There are no values to analyze for 'null_test', defaulting to 'targetless'.")
))

;train a value into the null features and verify that it's removed from inactives and feature weights are updated
Expand Down
18 changes: 9 additions & 9 deletions unit_tests/ut_h_params.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@
(contains_index result "label1")
(contains_index result "label2")
(contains_index result "action")
(contains_index (list result "label1" "full") "k")
(contains_index (list result "label1" "full") "p")
(contains_index (list result "label1" "full") "dt")
(contains_index (list result "label2" "full") "k")
(contains_index (list result "label2" "full") "p")
(contains_index (list result "label2" "full") "dt")
(contains_index (list result "action" "full") "k")
(contains_index (list result "action" "full") "p")
(contains_index (list result "action" "full") "dt")
(contains_index result (list "label1" "action.label2." "full") "k")
(contains_index result (list "label1" "action.label2." "full") "p")
(contains_index result (list "label1" "action.label2." "full") "dt")
(contains_index result (list "label2" "action.label1." "full") "k")
(contains_index result (list "label2" "action.label1." "full") "p")
(contains_index result (list "label2" "action.label1." "full") "dt")
(contains_index result (list "action" "label1.label2." "full") "k")
(contains_index result (list "action" "label1.label2." "full") "p")
(contains_index result (list "action" "label1.label2." "full") "dt")
)
))

Expand Down
2 changes: 1 addition & 1 deletion unit_tests/ut_iris_generate_data.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
))

(print "ordinal feature bounds: ")
(call assert_same (assoc exp 4.85 obs (get result "sepal_length" )))
(call assert_same (assoc exp 4.85 obs (first result)))

(call_entity "howso" "set_feature_attributes" (assoc
feature_attributes
Expand Down

0 comments on commit d48a245

Please sign in to comment.