Esempio n. 1
0
def run_once(args):
    '''
        given the train/test files, run for once to see the results
    '''

    config = init_exp_configs(args.config)
    update_configs(config, args)
    set_logfile(config, args)
    data_loader = DataLoader(config)

    run_glasso(config, data_loader)
Esempio n. 2
0
def run_vary_mg(config):
    '''
        run meta-graph one by one
    if 'yelp' in filename:
        ind2mg = {1: 'M1', 2: 'M9', 3: 'M9', 4: 'M4', 5: 'M7', 6: 'M6', 7: 'M5', 8: 'M3', 9: 'M3', 10: 'M2', 11: 'M8', 12: 'M8'}
    elif 'amazon' in filename:
        ind2mg = {1: 'M1', 2: 'M6', 3: 'M6', 4: 'M3', 5: 'M4', 6: 'M2', 7: 'M2', 8: 'M5', 9: 'M5'}
    '''
    if 'yelp' in config['dt']:
        mg_inds = [[0], [9], [7, 8], [3], [6], [5], [4], [10, 11], [1, 2]]
    elif 'amazon' in config['dt']:
        mg_inds = [[0], [5, 6], [3], [4], [7, 8], [1, 2]]
    meta_graphs = config['meta_graphs']
    for inds in mg_inds:
        config['meta_graphs'] = [meta_graphs[i] for i in inds]

        logging.info('run single meta_graph %s', config['meta_graphs'])
        data_loader = DataLoader(config)
        run_glasso(config, data_loader)
        logging.info('finish single meta_graph %s', config['meta_graphs'])
Esempio n. 3
0
def run():
    '''
        given the train/test files, run for once to see the results
    '''
    args = get_args()

    config = init_exp_configs(args.config)
    update_configs(config, args)
    set_logfile(config, args)

    data_loader = DataLoader(config)

    if config['exp_type'] in ['vary_reg', 'mp_vary_reg']:
        run_vary_reg(config, data_loader)
    if config['exp_type'] in ['vary_K', 'mp_vary_K']:
        print 'run %s, check log in %s' % (config['exp_type'],
                                           config['log_filename'])
        run_vary_K(config, data_loader)
    if config['exp_type'] in ['vary_mg']:
        print 'run %s, check log in %s' % (config['exp_type'],
                                           config['log_filename'])
        run_vary_mg(config)
Esempio n. 4
0
from data_util import DataLoader
from model import OCRnet
datadir="./Dataset2"
classes=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

print("----- data loading -----")
loader=DataLoader(datadir,classes)
print("----- Model creating -----")
ocrnet=OCRnet(loader.GetNumClasses(),classes)
ocrnet.load_model("./ocrnetmodel2.model")
print("----- Model -----")
print(ocrnet.model)
x,y=loader.GetTrainingData()
val_x,val_y=loader.GetTestingData()
print("----- testing started -----")
print(ocrnet.test_model(x,y))