Exemplo n.º 1
0
def with_games(name, query, path, method='skip_1'):
    '''Trains a model games that have already been scraped.'''
    begin = time.time()
    dts.build_and_dump(name, query, method=method, path=path)
    #dumps model
    trn.train_and_save(name, 'logistic_regression')
    tst.irun(name, query, 3)
    print 'Time:', time.time()-begin   
Exemplo n.º 2
0
def simple_test(name, query, method='skip_1'):
    '''Builds, train, and interactively test a simple model with few games, 
    for debugging.'''
    urls = scr.getURLs('20151128')
    dts.build_and_dump(name, query, method=method, urls=urls)
    # dumps model
    trn.train_and_save(name, 'logistic_regression')
    tst.irun(name, query, 3)
Exemplo n.º 3
0
def full_test(name, query, train_set, test_set, method):
    '''Performs a full automated test.
    
    @param name: test and model name, arbitrary
    @param query: question to train on
    @param train_set: name of the training set of games
    @param test_set: name of testing set of games
    @param method: feature extraction method
    '''
    path = 'games/{}'.format(train_set)
    begin = time.time()
    dts.build_and_dump(name, query, method=method, path=path)
    trn.train_and_save(name, 'logistic_regression')
    print time.time()-begin
    return tst.test(name, test_set, query, method)