Exemplo n.º 1
0
def exp_b(name):
    # 5 appliances and normal cost func
    # avg valid cost =  1.6496223211
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        appliances=[
            ['fridge freezer', 'fridge', 'freezer'], 
            'hair straighteners', 
            'television',
            'dish washer',
            ['washer dryer', 'washing machine']
        ],
        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,
        loss_function=lambda x, t: mdn_nll(x, t).mean(),
    ))
    net_dict_copy['layers_config'].extend([
        {
            'type': MixtureDensityLayer,
            'num_units': source.n_outputs,
            'num_components': 2
        }
    ])
    net = Net(**net_dict_copy)
    return net
Exemplo n.º 2
0
def exp_b(name):
    # 5 appliances and normal cost func
    # avg valid cost =  1.6496223211
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(
        dict(appliances=[['fridge freezer', 'fridge', 'freezer'],
                         'hair straighteners', 'television', 'dish washer',
                         ['washer dryer', 'washing machine']],
             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,
            loss_function=lambda x, t: mdn_nll(x, t).mean(),
        ))
    net_dict_copy['layers_config'].extend([{
        'type': MixtureDensityLayer,
        'num_units': source.n_outputs,
        'num_components': 2
    }])
    net = Net(**net_dict_copy)
    return net
Exemplo n.º 3
0
def exp_b(name):
    # 5 appliances and normal cost func
    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=lambda x, t: mdn_nll(x, t).mean(),
        ))
    net_dict_copy['layers_config'].extend([{
        'type': MixtureDensityLayer,
        'num_units': source.n_outputs,
        'num_components': 2
    }])
    net = Net(**net_dict_copy)
    return net
Exemplo n.º 4
0
def exp_b(name):
    # 5 appliances and normal cost func
    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=lambda x, t: mdn_nll(x, t).mean(),
    ))
    net_dict_copy['layers_config'].extend([
        {
            'type': MixtureDensityLayer,
            'num_units': source.n_outputs,
            'num_components': 2
        }
    ])
    net = Net(**net_dict_copy)
    return net
Exemplo n.º 5
0
    reshape_target_to_2D=True
    # input_stats={'mean': np.array([ 0.05526326], dtype=np.float32),
    #              'std': np.array([ 0.12636775], dtype=np.float32)},
    # target_stats={
    #     'mean': np.array([ 0.04066789,  0.01881946,  
    #                        0.24639061,  0.17608672,  0.10273963], 
    #                      dtype=np.float32),
    #     'std': np.array([ 0.11449792,  0.07338708,  
    #                    0.26608968,  0.33463112,  0.21250485], 
    #                  dtype=np.float32)}
)


net_dict = dict(        
    save_plot_interval=SAVE_PLOT_INTERVAL,
    loss_function=lambda x, t: mdn_nll(x, t).mean(),
#    loss_function=lambda x, t: mse(x, t).mean(),
    updates_func=momentum,
    learning_rate=1e-03,
   learning_rate_changes_by_iteration={
       100: 5e-04, 
       500: 1e-04
        # 1000: 5e-05, 
        # 2000: 1e-05, 
        # 3000: 5e-06,
        # 4000: 1e-06,
        # 10000: 5e-07,
        # 50000: 1e-07
    },
    plotter=MDNPlotter
)
Exemplo n.º 6
0
def callback(net, epoch):
    net.source.reshape_target_to_2D = True
    net.plotter = MDNPlotter(net)
    net.generate_validation_data_and_set_shapes()
    net.loss_function = lambda x, t: mdn_nll(x, t).mean()
    net.learning_rate = 1e-05
Exemplo n.º 7
0
def callback(net, epoch):
    net.source.reshape_target_to_2D = True
    net.plotter = MDNPlotter(net)
    net.generate_validation_data_and_set_shapes()
    net.loss_function = lambda x, t: mdn_nll(x, t).mean()
    net.learning_rate = 1e-05