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)
    if appliance == 'dish washer' and architecture == 'rectangles':
        epochs = 200000
        net_dict.pop('epochs')
    else:
        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
Esempio n. 2
0
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
Esempio n. 3
0
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': Conv1DLayer,
            'num_filters': 80,
            'filter_length': 5,
            'stride': 5,
            'nonlinearity': sigmoid
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': LSTMLayer,
            'num_units': 80,
            'W_in_to_cell': Uniform(5)
        },
        {
            'type': DenseLayer,
            'num_units': source.n_outputs,
            'nonlinearity': sigmoid
        }
    ]
)

net.print_net()
net.compile()
net.fit()
Esempio n. 4
0
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': Conv1DLayer,
            'num_filters': 80,
            'filter_length': 5,
            'stride': 5,
            'nonlinearity': sigmoid
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': LSTMLayer,
            'num_units': 80,
            'W_in_to_cell': Uniform(5)
        },
        {
            'type': DenseLayer,
            'num_units': source.n_outputs,
            'nonlinearity': sigmoid
        }
    ])
net.print_net()
net.compile()
net.fit()