77from concept_formation .structure_mapper import rename_flat
88
99from apprentice .agents .base import BaseAgent
10- from apprentice .learners .WhenLearner import get_when_learner
11- from apprentice .learners .WhereLearner import get_where_learner
10+ # from apprentice.learners.WhenLearner import get_when_learner
11+ from apprentice .learners .WhenLearner import WHEN_CLASSIFIERS
12+ # from apprentice.learners.WhereLearner import get_where_learner
13+ from apprentice .learners .WhereLearner import MostSpecific
1214from apprentice .planners .fo_planner import FoPlanner , execute_functions , unify , subst
1315# from ilp.fo_planner import Operator
1416
15- # from planners.rulesets import function_sets
16- # from planners.rulesets import feature_sets
17+ from apprentice . working_memory . fo_planner_operators import functionsets
18+ from apprentice . working_memory . fo_planner_operators import featuresets
1719
1820# search_depth = 1
1921# epsilon = .9
@@ -166,14 +168,15 @@ class WhereWhenHowNoFoa(BaseAgent):
166168 This is the basis for the 2 mechanism model.
167169 """
168170 def __init__ (self , feature_set , function_set ,
169- when_learner = 'trestle' , where_learner = 'MostSpecific' ,
171+ when_learner = 'decisiontree' , # where_learner='MostSpecific',
170172 search_depth = 1 , numerical_epsilon = 0.0 ):
171- self .where = get_where_learner (where_learner )
172- self .when = get_when_learner (when_learner )
173+ self .where = MostSpecific
174+ # self.when = get_when_learner(when_learner)
175+ self .when = WHEN_CLASSIFIERS [when_learner ]
173176 self .skills = {}
174177 self .examples = {}
175- self .feature_set = feature_set
176- self .function_set = function_set
178+ self .feature_set = featuresets [ feature_set ]
179+ self .function_set = functionsets [ function_set ]
177180 self .search_depth = search_depth
178181 self .epsilon = numerical_epsilon
179182
@@ -452,8 +455,8 @@ def explanations_from_how_search(self,state,sai,input_args):
452455 return explanations
453456
454457
455- def train (self , state , selection , action , inputs , reward , skill_label ,
456- foci_of_attention ):
458+ def train (self , state , sai , reward ,
459+ skill_label , foci_of_attention , ** kw ):
457460 """
458461 Doc String
459462 """
@@ -471,6 +474,11 @@ def train(self, state, selection, action, inputs, reward, skill_label,
471474 # label = 'math'
472475
473476 # create example dict
477+
478+ selection = sai .selection
479+ action = sai .action
480+ inputs = sai .inputs
481+
474482 example = {}
475483 example ['state' ] = state
476484 example ['skill_label' ] = skill_label
0 commit comments