In [1]:
import sys
import seaborn as sns
sys.path.append("..")
%matplotlib inline
sns.set(rc={'image.cmap': 'Purples_r'})
In [2]:
import lib.ngagent as ngagent
Let's create an agent. Vocabulary and strategy are created at the same time.
In [3]:
ag_cfg = {
'agent_id':'test',
'voc_cfg':{
'voc_type':'sparse_matrix',
'M':5,
'W':10
},
'strat_cfg':{
'strat_type':'naive',
'voc_update':'Minimal'
}
}
testagent=ngagent.Agent(**ag_cfg)
testagent
Out[3]:
In [4]:
print(testagent)
In [5]:
import random
M=ag_cfg['voc_cfg']['M']
W=ag_cfg['voc_cfg']['W']
for i in range(0,15):
k=random.randint(0,M-1)
l=random.randint(0,W-1)
testagent._vocabulary.add(k,l,1)
print(testagent)
We can get visuals of agent objects from strategy and vocabulary visuals, with same syntax.
In [6]:
testagent.visual()
testagent.visual("hom")
In [7]:
testagent.visual()
testagent.visual("syn")
In [8]:
testagent.visual()
testagent.visual("pick_mw",iterr=500)
In [9]:
testagent.visual()
testagent.visual("guess_m",iterr=500)
In [10]:
testagent.visual()
testagent.visual("pick_w",iterr=500)
In [ ]:
In [ ]:
In [ ]: