Skip to content

Commit

Permalink
22287: Updates for Amalgam language changes (#385)
Browse files Browse the repository at this point in the history
Co-authored-by: howsoRes <[email protected]>
  • Loading branch information
howsohazard and howsoRes authored Dec 17, 2024
1 parent 39d3bfd commit ea90485
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 44 deletions.
5 changes: 1 addition & 4 deletions howso/analysis.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -1094,10 +1094,7 @@
(first
(contained_entities (list
(query_not_equals (current_value 1) (null))
(if valid_weight_feature
(query_weighted_sample weight_feature 1)
(query_sample 1)
)
(query_sample 1 (if valid_weight_feature weight_feature))
))
)
)
Expand Down
5 changes: 1 addition & 4 deletions howso/analysis_weights.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,7 @@
sample_cases
(contained_entities [
(query_exists !internalLabelSession)
(if use_case_weights
(query_weighted_sample weight_feature 1000)
(query_sample 1000)
)
(query_sample 1000 (if use_case_weights weight_feature))
])
))

Expand Down
27 changes: 6 additions & 21 deletions howso/get_cases.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,16 @@
case_weight_feature (null)
)
(if (!= (null) num)
(if (!= (null) rand_seed)
(contained_entities (list
(query_exists !internalLabelSession)
(if case_weight_feature
(query_weighted_sample case_weight_feature num rand_seed)
(query_sample num rand_seed)
)
))

(contained_entities (list
(query_exists !internalLabelSession)
(if case_weight_feature
(query_weighted_sample case_weight_feature num (rand))
(query_sample num (rand))
)
))
)
(contained_entities (list
(query_exists !internalLabelSession)
(query_sample num case_weight_feature
(if (!= (null) rand_seed) rand_seed (rand)))
))

;else return samples with replacement on all cases
(contained_entities (list
(query_exists !internalLabelSession)
(if case_weight_feature
(query_weighted_sample case_weight_feature (call !GetNumTrainingCases) (rand))
(query_sample (call !GetNumTrainingCases) (rand))
)
(query_sample (call !GetNumTrainingCases) case_weight_feature (rand))
))
)
)
Expand Down
6 changes: 1 addition & 5 deletions howso/react_series_utilities.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -939,11 +939,7 @@
(first
(compute_on_contained_entities (list
(query_not_equals (current_value 1) (null))
(if valid_weight_feature
(query_weighted_sample weight_feature 1 (rand))

(query_sample 1 (rand))
)
(query_sample 1 (if valid_weight_feature weight_feature) (rand))
))
)
(current_value)
Expand Down
4 changes: 2 additions & 2 deletions howso/residuals.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@
(query_not_equals (current_index) (null))

(if valid_weight_feature
(query_weighted_sample weight_feature (- min_value_count (current_value)) (rand))
(query_sample (- min_value_count (current_value)) (rand))
(query_sample (- min_value_count (current_value)) weight_feature (rand))
(query_sample (- min_value_count (current_value)) (null) (rand))
)
))
num_valid_values_per_feature_map
Expand Down
8 changes: 4 additions & 4 deletions howso/synthesis.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
(lambda (query_exists (current_value)))
not_null_features_list
)
(query_sample 1 (rand))
(query_sample 1 (null) (rand))
))
)
))
Expand Down Expand Up @@ -509,7 +509,7 @@
(declare (assoc
;randomly choose a neighbor case index by its weight
random_weighted_case_id
(weighted_rand
(rand
;pass in associated lists of index of local case -> its weight in the order of
;local_case_ids to ensure reproduceability for random seeds
(get react_map "local_model_cases_map")
Expand Down Expand Up @@ -569,9 +569,9 @@
(query_exists !internalLabelSession)
(if valid_weight_feature
;select case using weighted random
(query_weighted_sample weight_feature 1 (rand) )
(query_sample 1 weight_feature (rand) )
;else just select a random case
(query_sample 1 (rand))
(query_sample 1 (null) (rand))
)
))
)
Expand Down
6 changes: 3 additions & 3 deletions howso/synthesis_utilities.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@

;output random class based on probability, doesn't contain nulls, non string nominals should be output as numeric
(if (contains_index !numericNominalFeaturesMap feature)
(+ (weighted_rand class_probabilities_map))
(weighted_rand class_probabilities_map)
(+ (rand class_probabilities_map))
(rand class_probabilities_map)
)
)

;else output random class based on probabliity, nulls are allowed
(let
(assoc output_value (weighted_rand class_probabilities_map))
(assoc output_value (rand class_probabilities_map))

;non string nominals should be output as numeric
(if (contains_index !numericNominalFeaturesMap feature)
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "0.0.0",
"dependencies": {
"amalgam": "57.0.9"
"amalgam": "58.0.0"
}
}

0 comments on commit ea90485

Please sign in to comment.