def exp_n(name): # lag = 25 # avg valid cost = 0.7634134889 source_dict_copy = deepcopy(source_dict) source_dict_copy['lag'] = 25 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) N = 50 net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': BidirectionalRecurrentLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1/sqrt(N)), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 3, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.max }, { 'type': BidirectionalRecurrentLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1/sqrt(N)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1/sqrt(N))) } ] net = Net(**net_dict_copy) return net
def exp_h(name): # replace tanh with sigmoid source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [{ 'type': DenseLayer, 'num_units': 40, 'nonlinearity': sigmoid, 'W': Normal(std=1) }, { 'type': DenseLayer, 'num_units': 40, 'nonlinearity': sigmoid }, { 'type': BidirectionalRecurrentLayer, 'num_units': 40, 'gradient_steps': GRADIENT_STEPS, 'nonlinearity': sigmoid, 'learn_init': False, 'precompute_input': False }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': Conv1DLayer, 'num_filters': 40, 'filter_length': 4, 'stride': 4, 'nonlinearity': sigmoid }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': BidirectionalRecurrentLayer, 'num_units': 40, 'gradient_steps': GRADIENT_STEPS, 'nonlinearity': sigmoid, 'learn_init': False, 'precompute_input': False }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': T.nnet.softplus }] net = Net(**net_dict_copy) return net
def exp_j(name): # 3 BLSTM layers # avg valid cost = 0.7796924710 source_dict_copy = deepcopy(source_dict) source_dict_copy['subsample_target'] = 3 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) N = 50 net_dict_copy['layers_config'] = [ { 'type': BLSTMLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=1.), 'peepholes': False }, { 'type': BLSTMLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=(1/sqrt(N))), 'peepholes': False }, { 'type': FeaturePoolLayer, 'ds': 3, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.max }, { 'type': BLSTMLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=(1/sqrt(N))), 'peepholes': False }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1/sqrt(N))) } ] net = Net(**net_dict_copy) return net
def exp_e(name): # As E but with Uniform(25) init # source = RealApplianceSource(**source_dict) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'][-1].update({'W_in_to_cell': Uniform(25)}) net_dict_copy['layers_config'].append( { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid } ) net = Net(**net_dict_copy) return net
def exp_f(name): # As A but with cross entropy and learning rate 0.1 # source = RealApplianceSource(**source_dict) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['updates'] = partial(nesterov_momentum, learning_rate=0.1) net_dict_copy['layers_config'].append( { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid } ) net = Net(**net_dict_copy) return net
def exp_a(name): global source source = RealApplianceSource(**source_dict) net_dict_copy = deepcopy(net_dict) net_dict_copy['loss_function'] = scaled_cost net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'].append( { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid } ) net = Net(**net_dict_copy) return net
def exp_a(name): # 5 appliances # avg valid cost = 1.1260980368 global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'].extend([{ 'type': MixtureDensityLayer, 'num_units': source.n_outputs, 'num_components': 2 }]) net = Net(**net_dict_copy) return net
def exp_e(name): # as A but lag = 80 source_dict_copy = deepcopy(source_dict) source_dict_copy['lag'] = 80 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'].append({ 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid }) net = Net(**net_dict_copy) return net
def exp_a(name): global source source_dict_copy = deepcopy(source_dict) source_dict_copy['appliances'] = [['fridge freezer', 'fridge', 'freezer'], 'hair straighteners', 'television', 'dish washer', ['washer dryer', 'washing machine']] source_dict_copy['skip_probability'] = 0.7 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 5, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.mean }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(25))) } ] net = Net(**net_dict_copy) return net
def exp_a(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) N = 512 output_shape = source.output_shape_after_processing() net_dict_copy['layers_config'] = [ { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) # (batch, features, time) }, { 'type': Conv1DLayer, # convolve over the time axis 'num_filters': 32, 'filter_length': 4, 'stride': 1, 'nonlinearity': rectify, 'border_mode': 'same' }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) # back to (batch, time, features) }, { 'type': DenseLayer, 'num_units': N * 2, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': N, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': N // 2, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': output_shape[1] * output_shape[2], 'nonlinearity': sigmoid } ] net = Net(**net_dict_copy) return net
def exp_b(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) net_dict_copy['layers_config'] = [ { 'type': DenseLayer, 'num_units': SEQ_LENGTH, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': SEQ_LENGTH // 4, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': SEQ_LENGTH // 8, 'nonlinearity': rectify }, { # MIDDLE LAYER 'type': DenseLayer, 'num_units': 32, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': SEQ_LENGTH // 8, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': SEQ_LENGTH // 4, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': SEQ_LENGTH, 'nonlinearity': None } ] net = Net(**net_dict_copy) return net
def exp_a(name): # 3 appliances global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) N = 25 net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 4, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.max }, { 'type': BidirectionalRecurrentLayer, 'num_units': N, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1/sqrt(N)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'W': Normal(std=1/sqrt(N)), 'nonlinearity': T.nnet.softplus } # { # 'type': MixtureDensityLayer, # 'num_units': source.n_outputs, # 'num_components': 1, # 'nonlinearity_mu': T.nnet.softplus # } ] net = Net(**net_dict_copy) return net
def exp_a(name): global source try: a = source except NameError: source = RealApplianceSource(**source_dict) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'].append({ 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(100))) }) net = Net(**net_dict_copy) return net
def exp_c(name): # BLSTM global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) N = 50 net_dict_copy['layers_config'] = [ { 'type': BLSTMLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False, 'W_in_to_cell': Normal(std=1.) }, { 'type': BLSTMLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False, 'W_in_to_cell': Normal(std=1/sqrt(N)) }, { 'type': FeaturePoolLayer, 'ds': 4, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.max }, { 'type': BLSTMLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False, 'W_in_to_cell': Normal(std=1/sqrt(N)) }, { 'type': MixtureDensityLayer, 'num_units': source.n_outputs, 'num_components': 2 } ] net = Net(**net_dict_copy) return net
def exp_e(name): # failed source_dict_copy = deepcopy(source_dict) source_dict_copy['input_padding'] = 0 source_dict_copy['subsample_target'] = 3 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [{ 'type': BLSTMLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False, 'W_in_to_cell': Normal(std=1.) }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': Conv1DLayer, 'num_filters': 80, 'filter_length': 3, 'stride': 3, 'nonlinearity': tanh, 'W': Normal(std=(1 / sqrt(50))) }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': BLSTMLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False, 'W_in_to_cell': Normal(std=(1 / sqrt(50))) }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(50))) }] net = Net(**net_dict_copy) return net
def exp_b(name): # Same as A but with Uniform(5) source = RealApplianceSource( filename='/data/dk3810/ukdale.h5', appliances=[ ['fridge freezer', 'fridge', 'freezer'], 'hair straighteners', 'television' # 'dish washer', # ['washer dryer', 'washing machine'] ], max_appliance_powers=[300, 500, 200], #, 2500, 2400], on_power_thresholds=[20, 20, 20], #, 20, 20], max_input_power=1000, min_on_durations=[60, 60, 60], #, 1800, 1800], window=("2013-06-01", "2014-07-01"), seq_length=1000, output_one_appliance=False, boolean_targets=False, min_off_duration=60, train_buildings=[1], validation_buildings=[1], skip_probability=0, n_seq_per_batch=50 ) net = Net( experiment_name=name, source=source, save_plot_interval=SAVE_PLOT_INTERVAL, loss_function=crossentropy, updates=partial(nesterov_momentum, learning_rate=0.01), layers_config=[ { 'type': BLSTMLayer, 'num_units': 50, 'W_in_to_cell': Uniform(5), 'gradient_steps': GRADIENT_STEPS }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid } ] ) return net
def exp_a(name): global source # source_dict_copy = deepcopy(source_dict) # source = RealApplianceSource(**source_dict_copy) source.subsample_target = 5 net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': Conv1DLayer, 'num_filters': 5, 'filter_length': 5, 'stride': 5, 'nonlinearity': tanh, 'W': Normal(std=1/sqrt(25)) }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1/sqrt(25)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1/sqrt(25))) } ] net = Net(**net_dict_copy) return net
def exp_a(name): # Trains but doesn't do well at discriminating source = RealApplianceSource( filename='/data/dk3810/ukdale.h5', appliances= [['fridge freezer', 'fridge', 'freezer'], 'hair straighteners', 'television' # 'dish washer' # ['washer dryer', 'washing machine'] ], max_appliance_powers=[300, 500, 200, 2500, 2400], on_power_thresholds=[5, 5, 5, 5, 5], max_input_power=5900, min_on_durations=[60, 60, 60, 1800, 1800], min_off_durations=[12, 12, 12, 1800, 600], window=("2013-06-01", "2014-07-01"), seq_length=1500, output_one_appliance=False, boolean_targets=False, train_buildings=[1], validation_buildings=[1], skip_probability=0.0, n_seq_per_batch=25, include_diff=True) net = Net(experiment_name=name, source=source, save_plot_interval=250, loss_function=mse, updates=partial(nesterov_momentum, learning_rate=.1, clip_range=(-1, 1)), layers_config=[{ 'type': DenseLayer, 'num_units': 50, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': 50, 'nonlinearity': rectify }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None }]) return net
def exp_b(name): # 3 appliances global source source_dict_copy = deepcopy(source_dict) source_dict_copy['appliances'] = [['fridge freezer', 'fridge', 'freezer'], 'hair straighteners', 'television'] source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) N = 50 net_dict_copy['layers_config'].extend([{ 'type': MixtureDensityLayer, 'num_units': source.n_outputs, 'num_components': 2 }]) net = Net(**net_dict_copy) return net
def exp_x(name): try: source.lag = 1 source.target_is_diff = False except NameError: global source source = RealApplianceSource(**source_dict) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'].append({ 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': sigmoid, 'W': Normal(std=(1 / sqrt(50))) }) net = Net(**net_dict_copy) return net
def exp_q(name): # 3x pooling not 5x # best valid cost = 0.3535898030 at iteration 450 global source source_dict_copy = deepcopy(source_dict) source_dict_copy['subsample_target'] = 3 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 3, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.mean }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(25))) } ] net = Net(**net_dict_copy) return net
def exp_o(name): # Larger net # Best performance yet. Valid cost of 0.129 at 470 iterations! global source source_dict_copy = deepcopy(source_dict) source_dict_copy['subsample_target'] = 5 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 5, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.mean }, { 'type': BidirectionalRecurrentLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(50)), 'nonlinearity': tanh }, { 'type': BidirectionalRecurrentLayer, 'num_units': 50, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(50)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(50))) } ] net = Net(**net_dict_copy) return net
def exp_a(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) output_shape = source.output_shape_after_processing() net_dict_copy['layers_config'] = [ { 'type': BLSTMLayer, 'num_units': 40, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': Conv1DLayer, 'num_filters': 20, 'filter_length': 4, 'stride': 4, 'nonlinearity': sigmoid }, { 'type': DimshuffleLayer, 'pattern': (0, 2, 1) }, { 'type': BLSTMLayer, 'num_units': 80, 'gradient_steps': GRADIENT_STEPS, 'peepholes': False }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': T.nnet.softplus } ] net = Net(**net_dict_copy) return net
def get_net(appliance, architecture): """ Parameters ---------- appliance : string architecture : {'rnn', 'ae', 'rectangles'} """ NET_DICTS = { 'rnn': net_dict_rnn, 'ae': net_dict_ae, 'rectangles': net_dict_rectangles } net_dict_func = NET_DICTS[architecture] source = get_source( appliance, logger, target_is_start_and_end_and_mean=(architecture == 'rectangles'), is_rnn=(architecture == 'rnn'), window_per_building={ # just load a tiny bit of data. Won't be used. 1: ("2013-04-12", "2013-05-12"), 2: ("2013-05-22", "2013-06-22"), 3: ("2013-02-27", "2013-03-27"), 4: ("2013-03-09", "2013-04-09"), 5: ("2014-06-29", "2014-07-29") }, source_type='real_appliance_source', filename=UKDALE_FILENAME ) seq_length = source.seq_length net_dict = net_dict_func(seq_length) epochs = net_dict.pop('epochs') net_dict_copy = deepcopy(net_dict) experiment_name = EXPERIMENT + "_" + appliance + "_" + architecture net_dict_copy.update(dict( source=source, logger=logger, experiment_name=experiment_name )) net = Net(**net_dict_copy) net.plotter.max_target_power = source.max_appliance_powers.values()[0] net.load_params(iteration=epochs, path=join(NET_BASE_PATH, experiment_name)) net.print_net() net.compile() return net
def exp_f(name): # ReLU hidden layers # linear output # output one appliance # 0% skip prob for first appliance # 100% skip prob for other appliances # input is diff global source source_dict_copy = deepcopy(source_dict) source_dict_copy['skip_probability'] = 0.75 source_dict_copy['lag'] = 15 source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) net_dict_copy['layers_config']= [ { 'type': RecurrentLayer, 'num_units': 50, 'W_in_to_hid': Normal(std=1), 'W_hid_to_hid': Identity(scale=0.9), 'nonlinearity': rectify, 'learn_init': False, 'precompute_input': True }, { 'type': RecurrentLayer, 'num_units': 50, 'W_in_to_hid': Normal(std=1/sqrt(50)), 'W_hid_to_hid': Identity(scale=0.9), 'nonlinearity': rectify, 'learn_init': False, 'precompute_input': True }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=1/sqrt(50)) } ] net = Net(**net_dict_copy) return net
def exp_c(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update( dict( experiment_name=name, source=source, loss_function=partial(scaled_cost3, ignore_inactive=True), )) net_dict_copy['layers_config'].extend([{ 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': T.nnet.softplus }]) net = Net(**net_dict_copy) return net
def exp_a(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict( experiment_name=name, source=source )) net_dict_copy['layers_config'].extend([ { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': T.nnet.softplus } ]) net = Net(**net_dict_copy) return net
def exp_j(name): # exp_d but Max instead of mean global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1.), 'nonlinearity': tanh }, { 'type': FeaturePoolLayer, 'ds': 5, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.max }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': BidirectionalRecurrentLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_hid': Normal(std=1 / sqrt(25)), 'nonlinearity': tanh }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(25))) } ] net = Net(**net_dict_copy) return net
def exp_i(name): # Not great global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [ { 'type': BLSTMLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=1.), 'peepholes': False }, { 'type': FeaturePoolLayer, 'ds': 5, # number of feature maps to be pooled together 'axis': 1, # pool over the time axis 'pool_function': T.mean }, { 'type': BLSTMLayer, 'num_units': 5, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=1 / sqrt(5)), 'peepholes': False }, { 'type': BLSTMLayer, 'num_units': 25, 'gradient_steps': GRADIENT_STEPS, 'W_in_to_cell': Normal(std=1 / sqrt(25)), 'peepholes': False }, { 'type': DenseLayer, 'num_units': source.n_outputs, 'nonlinearity': None, 'W': Normal(std=(1 / sqrt(25))) } ] net = Net(**net_dict_copy) return net
def exp_i(name): global source source_dict_copy = deepcopy(source_dict) source = RealApplianceSource(**source_dict_copy) net_dict_copy = deepcopy(net_dict) net_dict_copy.update(dict(experiment_name=name, source=source)) net_dict_copy['layers_config'] = [{ 'label': 'dense0', 'type': DenseLayer, 'num_units': SEQ_LENGTH, 'nonlinearity': None }, { 'type': SharedWeightsDenseLayer, 'num_units': SEQ_LENGTH, 'nonlinearity': None, 'W': 'ref:dense0.W.T' }] net = Net(**net_dict_copy) return net