示例#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 = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 256,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 128,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
示例#2
0
def exp_e(name):
    # conv then pool
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(logger=logging.getLogger(name)))
    source = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy["layers_config"] = [
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # (batch, features, time)
        {
            "type": Conv1DLayer,  # convolve over the time axis
            "num_filters": NUM_FILTERS,
            "filter_size": 4,
            "stride": 1,
            "nonlinearity": None,
            "border_mode": "same",
        },
        {
            "type": FeaturePoolLayer,
            "pool_size": 2,  # number of feature maps to be pooled together
            "axis": 2,  # pool over the time axis
            "pool_function": T.max,
        },
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # back to (batch, time, features)
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 256, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 128, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": target_seq_length, "nonlinearity": None},
    ]
    net = Net(**net_dict_copy)
    return net
示例#3
0
def exp_a(name):
    # no conv
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(logger=logging.getLogger(name)))
    source = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [{
        'type': DenseLayer,
        'num_units': 512,
        'nonlinearity': rectify
    }, {
        'type': DenseLayer,
        'num_units': 256,
        'nonlinearity': rectify
    }, {
        'type': DenseLayer,
        'num_units': 128,
        'nonlinearity': rectify
    }, {
        'type': DenseLayer,
        'num_units': target_seq_length,
        'nonlinearity': None
    }]
    net = Net(**net_dict_copy)
    return net
示例#4
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 = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy["layers_config"] = [
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # (batch, features, time)
        {
            "type": Conv1DLayer,  # convolve over the time axis
            "num_filters": NUM_FILTERS,
            "filter_size": 4,
            "stride": 1,
            "nonlinearity": None,
            "border_mode": "valid",
        },
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # back to (batch, time, features)
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 256, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 128, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": target_seq_length, "nonlinearity": sigmoid},
    ]
    net = Net(**net_dict_copy)
    return net
示例#5
0
def exp_e(name):
    # conv then pool
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(logger=logging.getLogger(name)))
    source = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'same'
        },
        {
            'type': FeaturePoolLayer,
            'pool_size': 2,  # number of feature maps to be pooled together
            'axis': 2,  # pool over the time axis
            'pool_function': T.max
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 256,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 128,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
示例#6
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 = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 256,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 128,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
示例#7
0
def exp_a(name):
    # no conv
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(logger=logging.getLogger(name)))
    source = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy["layers_config"] = [
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 256, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 128, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": target_seq_length, "nonlinearity": None},
    ]
    net = Net(**net_dict_copy)
    return net
示例#8
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 = SameLocation(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 256,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 128,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': sigmoid
        }
    ]
    net = Net(**net_dict_copy)
    return net