Tensorflow autoencoders with one vector per input neuron

I'm new to tensorflow and Deep neural networks. I'm currently trying to do anomaly detection on trajectories using autoencoders and i'm having an issue with my model.

I'm not able to get the right weight matrix / not sure how to do it.

Here is my model:

  • each input neuron of my encoder receive a vector with 4 features (this vector correspond to an observation which is a part of my trajectory).
  • The number of the input neurons correspond to the number of observation (which is 289).
  • I have a total of 336 trajectories which correspond to my batch
  • Therefore my input data shape is like (336,289,4)

  • I have two hidden layers; on each one we divide the number of the previous neurons by 2 so for h1 we have 144 neurons and h2 72 neurons
  • For my weights, i have:

    weights = {
        'encoder_h1': tf.Variable(tf.random_normal([336, n_hidden_1, 289])),
        'encoder_h2': tf.Variable(tf.random_normal([336, n_hidden_2, n_hidden_1])),
        'decoder_h1': tf.Variable(tf.random_normal([336, n_hidden_1, n_hidden_2])),
        'decoder_h2': tf.Variable(tf.random_normal([336, n_input, n_hidden_1 ])),
    }
    

    and my activation function is a sigmoid like

    tf.nn.sigmoid(tf.add(tf.matmul(weights['encoder_h1'],x),
                                       biases['encoder_b1'])
    

    But i'm afraid this gives a wheight matrix by trajectory or what i want is a weight matrix for all my trajectories, it should be a 2d tensor but i don't know how to proceed.

    I tried many thing such as removing the 336 part from my weight shape but tensorflow says tha its not possible to do matmul on 3d and 2d tensor.

    Do you have any idea on how to do?

    Thanks in advance for your help

    链接地址: http://www.djcxy.com/p/32086.html

    上一篇: Tensorflow定义了构建所有张量组件产品的操作

    下一篇: 每个输入神经元具有一个矢量的Tensorflow自动编码器