예제 #1
0
 def learning(self):
     mln = MLN(mlnfile=self.mln_path, grammar='StandardGrammar')
     db = Database(mln, dbfile=self.db_path)
     for method in ('BPLL', 'BPLL_CG', 'CLL'):
         print('=== LEARNING TEST:', method, '===')
         learn(method=method, mln=mln, db=db, verbose=True,
               multicore=False).run()
예제 #2
0
파일: test.py 프로젝트: Bovril/pracmln
def test_learning_taxonomies():
    p = '$PRACMLN_HOME/examples/taxonomies/taxonomies.pracmln'
    mln = MLN(mlnfile=('%s:senses_and_roles.mln' % p), grammar='PRACGrammar')
    mln.write()
    dbs = Database.load(mln, dbfiles='%s:training.db' % p)
    for method in ('DPLL', 'DBPLL_CG', 'DCLL'):
        for multicore in (True, False):
            print '=== LEARNING TEST:', method, '==='
            learn(method=method, mln=mln, db=dbs, verbose=True, multicore=multicore, epreds='is_a', discr_preds=EVIDENCE_PREDS).run()
예제 #3
0
파일: test.py 프로젝트: Bovril/pracmln
def test_learning_smokers():
    p = '$PRACMLN_HOME/examples/smokers/smokers.pracmln'
    mln = MLN(mlnfile=('%s:smoking.mln' % p), grammar='StandardGrammar')
    mln.write()
    db = Database(mln, dbfile='%s:smoking-train.db' % p)
    for method in ('BPLL', 'BPLL_CG', 'CLL'):
        for multicore in (True, False):
            print '=== LEARNING TEST:', method, '==='
            learn(method=method, mln=mln, db=db, verbose=True, multicore=multicore).run()
예제 #4
0
파일: test.py 프로젝트: Trixter9994/lazero
def test_learning_smokers():
    p = os.path.join(locs.examples, 'smokers', 'smokers.pracmln')
    mln = MLN(mlnfile=('%s:smoking.mln' % p), grammar='StandardGrammar')
    mln.write()
    db = Database(mln, dbfile='%s:smoking-train.db' % p)
    for method in ('BPLL', 'BPLL_CG', 'CLL'):
        for multicore in (True, False):
            print('=== LEARNING TEST:', method, '===')
            learn(method=method,
                  mln=mln,
                  db=db,
                  verbose=True,
                  multicore=multicore).run()
예제 #5
0
파일: test.py 프로젝트: Trixter9994/lazero
def test_learning_taxonomies():
    p = os.path.join(locs.examples, 'taxonomies', 'taxonomies.pracmln')
    mln = MLN(mlnfile=('%s:senses_and_roles.mln' % p), grammar='PRACGrammar')
    mln.write()
    dbs = Database.load(mln, dbfiles='%s:training.db' % p)
    for method in ('DPLL', 'DBPLL_CG', 'DCLL'):
        for multicore in (True, False):
            print('=== LEARNING TEST:', method, '===')
            learn(method=method,
                  mln=mln,
                  db=dbs,
                  verbose=True,
                  multicore=multicore,
                  epreds='is_a',
                  discr_preds=EVIDENCE_PREDS).run()
예제 #6
0
def test_learning_smokers(arg='.', disp=False):
    pth = os.path.join(arg, 'smoking.mln')
    mln = MLN(mlnfile=pth, grammar='StandardGrammar')
    pth = os.path.join(arg, 'smoking-train.db')
    db = Database(mln, dbfile=pth)
    for method in ('BPLL', 'BPLL_CG', 'CLL'):
        for multicore in (True, False):
            print('=== LEARNING TEST:', method, '===')
            if disp:
                query(queries='Cancer,Smokes,Friends',
                      method=method,
                      mln=mln,
                      db=db,
                      verbose=disp,
                      multicore=multicore).run().write()
            else:
                learn(method=method,
                      mln=mln,
                      db=db,
                      verbose=disp,
                      multicore=multicore).run()