예상 된 2 변수 gaussian 분포 매개 변수로부터 지상 진리 값 (x, y)을 얻는 부정적인 로그 가능성을 최소화하려고하는 손실 함수를 구현하려고합니다. ,2 변수 가우시안의 로그 우도 (log likelihood)의 음수 값
나는 훈련을하고있는 중이 야def tf_2d_normal(self, x, y, mux, muy, sx, sy, rho):
'''
Function that implements the PDF of a 2D normal distribution
params:
x : input x points
y : input y points
mux : mean of the distribution in x
muy : mean of the distribution in y
sx : std dev of the distribution in x
sy : std dev of the distribution in y
rho : Correlation factor of the distribution
'''
# eq 3 in the paper
# and eq 24 & 25 in Graves (2013)
# Calculate (x - mux) and (y-muy)
normx = tf.sub(x, mux)
normy = tf.sub(y, muy)
# Calculate sx*sy
sxsy = tf.mul(sx, sy)
# Calculate the exponential factor
z = tf.square(tf.div(normx, sx)) + tf.square(tf.div(normy, sy)) - 2*tf.div(tf.mul(rho, tf.mul(normx, normy)), sxsy)
negRho = 1 - tf.square(rho)
# Numerator
result = tf.exp(tf.div(-z, 2*negRho))
# Normalization constant
denom = 2 * np.pi * tf.mul(sxsy, tf.sqrt(negRho))
# Final PDF calculation
result = -tf.log(tf.div(result, denom))
return result
, 나는 손실 값이 감소 볼 수 있지만 그것을 잘 0 아래를지나 나는 그 때문에해야 이해할 수 간다 - 여기 를 코드입니다 - 나는 tensorflow이를 구현하고있다 우리는 '부정'가능성을 최소화하고 있습니다. 손실 값이 감소하더라도 정확한 결과를 얻을 수 없습니다. 내가 잃어버린 기능에 대해 작성한 코드가 맞는지 아닌지를 확인하는 데 도움을 줄 수 있습니까?
또한 신경망 (특히 RNN)을 학습하는 데 바람직한 손실의 성격이 있습니까?
Thankss는