我是张力流和深度神经网络的新手 . 我目前正在尝试使用自动编码器对轨迹进行异常检测,而我的模型存在问题 .

我无法获得正确的重量矩阵/不确定如何做到这一点 .

这是我的模型:

  • 我的编码器的每个输入神经元接收具有4个特征的向量(该向量对应于作为我的轨迹的一部分的观察) .

  • 输入神经元的数量对应于观察次数(即289) .

  • 我总共有336个轨迹与我的批次相对应

Therefore my input data shape is like (336,289,4)

  • 我有两个隐藏的层;在每一个我们将先前神经元的数量除以2所以对于 h1 我们有 144 neuronsh2 72 neurons

对于我的重量,我有:

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 ])),
}

我的激活功能是一个像sigmoid

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.

我尝试了很多东西,例如从我的重量形状中移除336部分,但张量流量说它不可能在3d和2d张量上做matmul .

你知道怎么做吗?

在此先感谢您的帮助