Esempio n. 1
0
def ae(batch):
    NUM_FILTERS = 8
    input_shape = batch.input.shape
    target_shape = batch.target.shape
    seq_length = input_shape[1]

    input_layer = InputLayer(shape=input_shape)

    # Dense layers
    dense_layer_0 = DenseLayer(input_layer,
                               num_units=(seq_length - 3) * NUM_FILTERS)
    dense_layer_1 = DenseLayer(dense_layer_0, num_units=128)
    dense_layer_2 = DenseLayer(dense_layer_1,
                               num_units=(seq_length - 3) * NUM_FILTERS)

    # Output
    final_dense_layer = DenseLayer(dense_layer_2,
                                   num_units=target_shape[1] * target_shape[2],
                                   nonlinearity=None)
    output_layer = ReshapeLayer(final_dense_layer, shape=target_shape)

    net = Net(output_layer,
              tags=['AE'],
              description=
              "Like AE in e575 but much larger layers.  Still no conv layers.",
              predecessor_experiment="e575")
    return net
Esempio n. 2
0
def ae(batch):
    NUM_FILTERS = 8
    input_shape = batch.input.shape
    target_shape = input_shape
    seq_length = input_shape[1]
    output_layer = build_net(
        input_shape=input_shape,
        layers=[
            {
                'type': DenseLayer,
                'num_units': (seq_length - 3) * NUM_FILTERS,
                'nonlinearity': rectify
            },
            {
                'type': DenseLayer,
                'num_units': 128,
                'nonlinearity': rectify
            },
            {
                'type': DenseLayer,
                'num_units': (seq_length - 3) * NUM_FILTERS,
                'nonlinearity': rectify
            },

            # Output
            {
                'type': DenseLayer,
                'num_units': target_shape[1] * target_shape[2],
                'nonlinearity': None
            },
            {
                'type': ReshapeLayer,
                'shape': target_shape
            }
        ])

    net = Net(output_layer,
              tags=['AE'],
              description="Identical AE to e576 but with rectify.",
              predecessor_experiment="e576")
    return net
Esempio n. 3
0
def ae(batch):
    input_shape = batch.input.shape
    target_shape = batch.target.shape

    input_layer = InputLayer(shape=input_shape)

    # Dense layers
    dense_layer_0 = DenseLayer(input_layer, num_units=128)
    dense_layer_1 = DenseLayer(dense_layer_0, num_units=64)
    dense_layer_2 = DenseLayer(dense_layer_1, num_units=128)

    # Output
    final_dense_layer = DenseLayer(dense_layer_2,
                                   num_units=target_shape[1] * target_shape[2],
                                   nonlinearity=None)
    output_layer = ReshapeLayer(final_dense_layer, shape=target_shape)

    net = Net(output_layer,
              tags=['AE'],
              description="Like AE in e567 but without conv layer",
              predecessor_experiment="e567")
    return net
Esempio n. 4
0
def ae(batch):
    NUM_FILTERS = 8
    input_shape = batch.input.shape
    seq_length = input_shape[1]
    output_layer = build_net(
        input_shape=input_shape,
        layers=[
            {
                '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,
                'pad': 'valid'
            },
            {
                'type': DimshuffleLayer,
                'pattern': (0, 2, 1)  # back to (batch, time, features)
            },
            {
                'type': DenseLayer,
                'num_units': (seq_length - 3) * NUM_FILTERS,
                'nonlinearity': rectify
            },
            {
                'type': DenseLayer,
                'num_units': 128,
                'nonlinearity': rectify
            },
            {
                'type': DenseLayer,
                'num_units': (seq_length - 3) * NUM_FILTERS,
                'nonlinearity': rectify
            },
            {
                'type': ReshapeLayer,
                'shape': (-1, (seq_length - 3), NUM_FILTERS)
            },
            {
                'type': DimshuffleLayer,
                'pattern': (0, 2, 1)  # (batch, features, time)
            },
            {  # DeConv
                'type': Conv1DLayer,
                'num_filters': 1,
                'filter_size': 4,
                'stride': 1,
                'nonlinearity': None,
                'pad': 'full'
            },
            {
                'type': DimshuffleLayer,
                'pattern': (0, 2, 1)  # back to (batch, time, features)
            }
        ])

    net = Net(output_layer,
              tags=['AE', 'Conv1D'],
              description="Identical AE to e567.  Trained on 5 appliances.",
              predecessor_experiment="e567")
    return net