From 7c1d45b574de33dafcd93b251fc089acff313292 Mon Sep 17 00:00:00 2001 From: Niclas Dobbertin Date: Sun, 1 Sep 2024 17:29:19 +0200 Subject: fix retrieval checks --- modeling/prod_addition.py | 3 +++ modeling/prod_comp.py | 10 ++++++++++ modeling/prod_numbers.py | 1 + modeling/prod_subtraction.py | 5 +++++ modeling/productions_math.py | 14 +++++++++++--- 5 files changed, 30 insertions(+), 3 deletions(-) (limited to 'modeling') diff --git a/modeling/prod_addition.py b/modeling/prod_addition.py index 27a0bcd..12473d3 100644 --- a/modeling/prod_addition.py +++ b/modeling/prod_addition.py @@ -15,6 +15,7 @@ def addition(Model): arg2 =num2 ones_ans None ?retrieval> + buffer empty state free ==> =g> @@ -217,6 +218,7 @@ def addition(Model): ones_carry 1 ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -310,6 +312,7 @@ def addition(Model): hundreds1 =hun1 hundreds2 =hun2 ?retrieval> + buffer empty state free ==> =g> diff --git a/modeling/prod_comp.py b/modeling/prod_comp.py index 84ae370..3b675ec 100644 --- a/modeling/prod_comp.py +++ b/modeling/prod_comp.py @@ -43,6 +43,7 @@ def greater_than(Model): hundreds_ans =hun1 tens_ans =ten1 ones_ans =one1 + ~retrieval> """, ) prods.append(arg1_greater) @@ -63,6 +64,7 @@ def greater_than(Model): hundreds_ans =hun2 tens_ans =ten2 ones_ans =one2 + ~retrieval> """, ) prods.append(arg2_greater) @@ -79,6 +81,7 @@ def greater_than(Model): hundreds_ans None ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -104,6 +107,7 @@ def greater_than(Model): tens2 =ten2 ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -130,6 +134,7 @@ def greater_than(Model): ones2 =one2 ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -319,6 +324,7 @@ def lesser_than(Model): hundreds_ans =hun1 tens_ans =ten1 ones_ans =one1 + ~retrieval> """, ) prods.append(arg1_lesser) @@ -339,6 +345,7 @@ def lesser_than(Model): hundreds_ans =hun2 tens_ans =ten2 ones_ans =one2 + ~retrieval> """, ) prods.append(arg2_lesser) @@ -355,6 +362,7 @@ def lesser_than(Model): hundreds_ans None ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -380,6 +388,7 @@ def lesser_than(Model): tens2 =ten2 ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -406,6 +415,7 @@ def lesser_than(Model): ones2 =one2 ?retrieval> state free + buffer empty ==> =g> isa math_goal diff --git a/modeling/prod_numbers.py b/modeling/prod_numbers.py index 965bcd9..b914b73 100644 --- a/modeling/prod_numbers.py +++ b/modeling/prod_numbers.py @@ -112,6 +112,7 @@ def number(Model): tens_ans =tens hundreds_ans =hunds ?retrieval> + buffer empty state free ==> =g> diff --git a/modeling/prod_subtraction.py b/modeling/prod_subtraction.py index 91137bb..1d1f73e 100644 --- a/modeling/prod_subtraction.py +++ b/modeling/prod_subtraction.py @@ -14,6 +14,7 @@ def subtraction(Model): arg2 =arg2 ?retrieval> state free + buffer empty ==> =g> isa math_goal @@ -191,6 +192,7 @@ def subtraction(Model): tens2 =num2 ones_carry 1 ?retrieval> + buffer empty state free ==> =g> @@ -264,6 +266,7 @@ def subtraction(Model): tens2 =num2 ones_carry 0 ?retrieval> + buffer empty state free ==> =g> @@ -387,6 +390,7 @@ def subtraction(Model): hundreds2 =num2 tens_carry 1 ?retrieval> + buffer empty state free ==> =g> @@ -460,6 +464,7 @@ def subtraction(Model): hundreds2 =num2 tens_carry 0 ?retrieval> + buffer empty state free ==> =g> diff --git a/modeling/productions_math.py b/modeling/productions_math.py index a3f6b02..07609bf 100644 --- a/modeling/productions_math.py +++ b/modeling/productions_math.py @@ -33,9 +33,9 @@ def add_proc(goal, proc): def start(): - condition = "random" - training_N = 5 - test_N = 5 + condition = "fixed" + training_N = 2 + test_N = 2 stimuli = model_env.Stimuli(condition, training_N=training_N, test_N=test_N) @@ -52,6 +52,10 @@ def start(): # op, arg1, arg2 = wait_input() Model, DM, goal, imaginal, env = init() # Model.model_parameters["subsymbolic"] = True + # Model.model_parameters["partial_matching"] = True + Model.model_parameters["activation_trace"] = True + Model.model_parameters["utility_alpha"] = 0.5 + Model.model_parameters["utility_noise"] = 0.5 Model.model_parameters["production_compilation"] = True Model.model_parameters["utility_learning"] = True # add_goal(goal, op, arg1, arg2) @@ -67,6 +71,9 @@ def start(): motor_prods = prod_motor.procedures(Model) visual_prods = prod_vis.procedures(Model) + for p in Model.productions: + Model.productions[p].__setitem__("utility", 1) + print("goal: ", goal) # print("imaginal: ", imaginal) sim = Model.simulation( @@ -85,6 +92,7 @@ def start(): if j > training_N: phase = "test" sim.step() + print(goal) if sim.current_event.time >= 900: print(sim.current_event) break -- cgit v1.2.3