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)
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)