예제 #1
0
파일: control.py 프로젝트: tommarek/dip
def _thread_bayes(db_file, count, n_fold_cv, max_token_size):
    from src.bayes.bayesian_test import BayesianTest
    bt = BayesianTest(dbfile=db_file, max_token_size=max_token_size)
    # run feature selection
    features = bt.get_best_features(count=count, n_fold_cv=n_fold_cv)
    # run test with best features
    result = bt.run(features=features, count=count, n_fold_cv=n_fold_cv)
    # return results
    return {'type':'bayes', 'result': result, 'features':features}
예제 #2
0
파일: control.py 프로젝트: tommarek/dip
def bayes_features(args):
    '''
    Function starts strats process of finding most suitable feature combination
    for selected dataset
    '''
    # process features
    # run
    bt = BayesianTest(dbfile=args.db_file, max_token_size=args.max_token_size)
    bt.get_best_features(count=args.count, n_fold_cv=args.n_fold_cv)
예제 #3
0
파일: control.py 프로젝트: tommarek/dip
def bayes_generate_model(args):
    '''
    Function creates model for bayesian classifier
    '''
    bt = BayesianTest(dbfile=args.db_file, max_token_size=args.max_token_size)

    if args.feats is not None:
        features = eval(args.feats)
        if isinstance(features,dict):
            e = Entry(id=None, guid=None, entry=None, language=None)
            if not e.check_feats(features):
                print 'Incorrect format of feature dictionary'
                return
    else:
        features = bt.get_best_features(count=args.count, n_fold_cv=args.n_fold_cv)

    bt.create_model(args.model, used_features=features, count=args.count)
예제 #4
0
파일: control.py 프로젝트: tommarek/dip
def bayes_test(args):
    '''
    Function starts test of bayesian classifier with given dataset and classifier
    parameters.
    '''
    bt = BayesianTest(dbfile=args.db_file, max_token_size=args.max_token_size)

    if args.feats is not None:
        features = eval(args.feats)
        if isinstance(features,dict):
            e = Entry(id=None, guid=None, entry=None, language=None)
            if not e.check_feats(features):
                print 'Incorrect format of feature dictionary'
                return
    else:
        features = bt.get_best_features(count=args.count, n_fold_cv=args.n_fold_cv)

    bt.run(features=features, count=args.count, n_fold_cv=args.n_fold_cv)