Ejemplo n.º 1
0
def svm_annealing(args):
    '''
    Function starts simulated annealing to find out ideal parameters for SVM
    classifier with given data.
    '''
    t = SVMTest()
    t.run_annealing(n_fold_cv=args.n_fold_cv, kernel=args.kernel)
Ejemplo n.º 2
0
def _thread_svm(db_file, count, max_token_size, n_fold_cv, kernel):
    from src.svm.svm_test import SVMTest
    t = SVMTest()
    # load data
    t.regenerate_data(dbfile=db_file, count=count,
            max_token_size=max_token_size)
    # run simulated annealing
    state, energy = t.run_annealing(n_fold_cv=n_fold_cv, kernel=kernel)
    # run test with optimal parameters
    result = t.run(c=state[1], param=state[0], n_fold_cv=n_fold_cv,
            kernel=kernel)
    # return results
    return {'type':'svm', 'result': result, 'state':state, 'emergy':energy}