コード例 #1
0
def exp_a(name, target_appliance, seq_length):
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        target_appliance=target_appliance,
        logger=logging.getLogger(name),
        seq_length=seq_length
    ))
    source = RandomSegmentsInMemory(**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': PolygonOutputLayer,
            'num_units': 2,
            'seq_length': seq_length
        },
        {
            'type': ReshapeLayer,
            'shape': source.output_shape()
        }
    ]
    net = Net(**net_dict_copy)
    return net
コード例 #2
0
def exp_a(name, target_appliance, seq_length):
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        target_appliance=target_appliance,
        logger=logging.getLogger(name),
        seq_length=seq_length
    ))
    source = RandomSegmentsInMemory(**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': PolygonOutputLayer,
            'num_units': 2,
            'seq_length': seq_length
        },
        {
            'type': ReshapeLayer,
            'shape': source.output_shape()
        }
    ]
    net = Net(**net_dict_copy)
    return net
コード例 #3
0
ファイル: e490.py プロジェクト: tolysz/neuralnilm_prototype
def exp_a(name, target_appliance, seq_length):
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        target_appliance=target_appliance,
        logger=logging.getLogger(name),
        seq_length=seq_length
    ))
    source = RandomSegmentsInMemory(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    NUM_FILTERS = 4
    target_seq_length = seq_length // source.subsample_target
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'label': 'conv0',
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_length': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'label': 'dense0',
            'type': DenseLayer,
            'num_units': (seq_length - 3) * NUM_FILTERS,
            'nonlinearity': rectify
        },
        {
            'label': 'dense2',
            'type': DenseLayer,
            'num_units': 128,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': (target_seq_length - 3) * NUM_FILTERS,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
コード例 #4
0
ファイル: e452.py プロジェクト: tolysz/neuralnilm_prototype
def exp_f(name):
    global source
    source_dict_copy = deepcopy(source_dict)
    source = RandomSegmentsInMemory(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 4
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'label': 'conv0',
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_length': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'label': 'dense0',
            'type': DenseLayer,
            'num_units': (SEQ_LENGTH - 3) * NUM_FILTERS,
            'nonlinearity': rectify
        },
        {
            'type': ReshapeLayer,
            'shape': (N_SEQ_PER_BATCH, SEQ_LENGTH - 3, NUM_FILTERS)
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': DeConv1DLayer,
            'num_output_channels': 1,
            'filter_length': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'full'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        }
    ]
    net = Net(**net_dict_copy)
    return net
コード例 #5
0
ファイル: e452.py プロジェクト: tolysz/neuralnilm_prototype
def exp_g(name):
    global source
    source_dict_copy = deepcopy(source_dict)
    source = RandomSegmentsInMemory(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 4
    net_dict_copy['layers_config'] = [{
        'label': 'dense0',
        'type': DenseLayer,
        'num_units': SEQ_LENGTH,
        'nonlinearity': rectify
    }, {
        'label': 'dense1',
        'type': DenseLayer,
        'num_units': 32,
        'nonlinearity': rectify
    }, {
        'type': DenseLayer,
        'num_units': SEQ_LENGTH,
        'nonlinearity': None
    }]
    net = Net(**net_dict_copy)
    return net