cfg = Config(config_file) avg_file = Utils.avg_file_name(cfg.netFile) if test == 'te': tr = DataSet([cfg.te_data[0]], cfg, sub_sample=0.1) else: tr = DataSet([cfg.tr_data[0]], cfg) tr.subtract_avg(avg_file, save_im=False) inputs = {} output = {} cfg.Nout = 3 cfg.att = 4 cfg.ref_node = cfg.nodes[0][-1] cfg.refs = np.ones(cfg.ref_node) cfg.refs = cfg.refs.reshape((1, cfg.ref_node)) inputs[0] = tf.placeholder(tf.float32, [None, cfg.ref_node]) for a in range(cfg.feature_len): inputs[a + 1] = tf.placeholder(tf.float32, [None, cfg.att]) input_dic = {} for a in range(cfg.feature_len + 1): input_dic['input_{}'.format(a)] = inputs[a] net = rNet(input_dic) net.real_setup(cfg, SIG=(cfg.SIG == 1))
#if len(sys.argv)>1: # config_file = sys.argv[1] test = None if len(sys.argv) > 1: test = sys.argv[1] cfg = Config(config_file) avg_file = avg_file_name(cfg.netFile) if test is None: tr = DataSet(cfg.tr_data, cfg) get_avg_file(tr, avg_file) te = DataSet(cfg.te_data, cfg, sub_sample=0.15) tr0 = DataSet([cfg.tr_data[0]], cfg, sub_sample=0.1) cfg.att = te.sz[1] tr.avg_correction(avg_file) tr0.avg_correction(avg_file) else: if test == 'te': te = DataSet([cfg.te_data[0]], cfg) else: te = DataSet([cfg.tr_data[0]], cfg) cfg.att = te.sz[1] te.avg_correction(avg_file) iterations = 10000 loop = cfg.loop print "input attribute", cfg.att, "LR", cfg.lr, \ 'feature', cfg.feature_len, 'add', cfg.add_len
cfg = Config(config_file) avg_file = avg_file_name(cfg.netFile) dt = 'te' if len(sys.argv)>1: dt = sys.argv[1] if dt=='te': te = DataSet(cfg.te_data, cfg) else: te = DataSet(cfg.tr_data, cfg) cfg.att = te.att te.avg_correction(avg_file) print("input attribute", cfg.att, "LR", cfg.lr, 'feature', cfg.feature_len, 'add', cfg.add_len) inputs = {} Nout = cfg.num_output - cfg.num_output1 setattr(cfg, 'Nout', Nout) # output = tf.placeholder(tf.float32, [None, cfg.num_output]) output = tf.placeholder(tf.float32, [None, Nout]) cfg.ref_node = cfg.nodes[0][-1] cfg.refs = np.ones(cfg.ref_node) #(np.array(range(cfg.ref_node)) + 1.0)/cfg.ref_node - 0.5