Ejemplo n.º 1
0
import hyper_opt
import model_train
import score_test
#import data_prep
from X_obj import HYP_obj

grid_path1 = '/home/chengtao/june/grid/lstm/'
grid_path2 = '/home/chengtao/june/grid/logr/'
hype_path1 = '/home/chengtao/june/hyper/lstm/'
hype_path2 = '/home/chengtao/june/hyper/logr/'
data_path = '/home/chengtao/june/data/svm_pos/'

G1 = HYP_obj(grid_path1)
G2 = HYP_obj(grid_path2)
G1.set_sequence('seq')
G2.set_sequence('utt')

X1 = HYP_obj(hype_path1) 
X2 = HYP_obj(hype_path2) 
X1.run(grid_path1,data_path)
X2.run(grid_path2,data_path)
X1.report()
X2.report()



Ejemplo n.º 2
0
    best = max(auc_list,key=lambda x: x[0])
    with open(output_path+'/dev.info','w') as f:
        for e in auc_list:
            f.write(e[1]+' {0:.2f}'.format(e[0]))
    with open(output_path+'/best.info','w') as f:
        f.write(best[1]+' {0:.2f}'.format(best[0]))
        
def best_path(path):
    try:
        print 'the best model is here'
        return open(path+'/best.info','r').read().split()[0]
    except:
        print 'the model is here'
        return path
def best_hyper(path):
    return best_path+'/hyper/'
def best_model(path):
    return best_path+'/model/'
"""


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="""trains a nemo model on the training set""")
    parser.add_argument("--input_path", type=str, default=grid_path, help="input: directory of the grid")
    parser.add_argument("--data_path", type=str, default=data_path, help="input: directory of the tra/dev data")
    parser.add_argument("--output_path", type=str, default=hyper_path, help="output: directory of the hyperparameters")
    args = parser.parse_args()
    # run(args.input_path, args.data_path, args.output_path)
    x = HYP_obj(args.output_path)
    x.run(args.input_path, args.data_path)