In [1]:
    
import sys
import seaborn as sns
sys.path.append("..")
%matplotlib inline
sns.set(rc={'image.cmap': 'Purples_r'})
    
In [3]:
    
import naminggamesal.ngdb as ngdb
import naminggamesal.ngsimu as ngsimu
    
Using ngdb instead of ngsimu, we create Experiments objects that are re-usable via a database. Execute the code below, and a second time for the graph().show() part, you will notice the difference between the 2 libs (testexp is ngdb.Experiment, testexp2 is ngsimu.Experiment).
In [35]:
    
xp_cfg={
    'pop_cfg':{
        'voc_cfg':{
            'voc_type':'pandas',
            #'voc_type':'sparse_matrix',
            #'M':5,
            #'W':10
            },
        'strat_cfg':{
            'strat_type':'naive',
            'voc_update':'minimal'
            },
        'interact_cfg':{
            'interact_type':'speakerschoice'
            },
        'env_cfg':{'env_type':'simple','M':5,'W':10},
        'nbagent':nbagent
        },
    'step':10
}
testexp=ngdb.Experiment(**xp_cfg)
testexp
testexp2=ngsimu.Experiment(**xp_cfg)
testexp2
    
    Out[35]:
In [46]:
    
testexp.continue_exp_until(0)
testexp2.continue_exp_until(3)
    
In [48]:
    
for i in range()
print testexp2._poplist.get_last()._agentlist[i]._vocabulary._content_m
print testexp2._poplist.get_last()._agentlist[i]._vocabulary._content_m.index
print testexp2._poplist.get_last()._agentlist[i]._vocabulary.get_accessible_words()
    
    
In [ ]:
    
testexp2._poplist.get_last()._agentlist[0]._vocabulary.add()
    
In [7]:
    
testexp.graph("entropy").show()
    
    
In [6]:
    
testexp2.graph("entropy").show()
    
    
In [7]:
    
db=ngdb.NamingGamesDB("ng2.db")
    
In [8]:
    
testexp3=db.get_experiment(force_new=True,**xp_cfg)
    
In [9]:
    
testexp3.continue_exp_until(200)
    
In [10]:
    
db.merge("naminggames.db",remove=False)
    
In [11]:
    
testexp3=db.get_experiment(force_new=False,**xp_cfg)
    
In [12]:
    
testexp3.continue_exp_until(100)
    
In [13]:
    
testexp3.graph("srtheo").show()
testexp3.graph("entropy").show()
    
    
    
In [14]:
    
testexp3.graph("entropy",X="srtheo").show()
    
    
In [15]:
    
testexp3.graph("entropy",X="interactions_per_agent").show()
    
    
In [ ]: