// since we operate with matrices not vectors, the output would have dimension (?,1)
// and therefor has to be reduce first to have shape (?,)
if self.data_normalization:
self.pdf_ = tf.reduce_sum(target_dist.prob(self.y_input), axis=1) / tf.reduce_prod(self.std_y_sym)
self.log_pdf_ = tf.reduce_sum(target_dist.log_prob(self.y_input), axis=1) - tf.reduce_sum(tf.log(self.std_y_sym))
self.cdf_ = tf.reduce_sum(target_dist.cdf(self.y_input), axis=1) / tf.reduce_prod(self.std_y_sym)
else:
self.pdf_ = tf.reduce_sum(target_dist.prob(self.y_input), axis=1)
self.log_pdf_ = tf.reduce_sum(target_dist.log_prob(self.y_input), axis=1)
self.cdf_ = tf.reduce_sum(target_dist.cdf(self.y_input), axis=1)
self.loss = -tf.reduce_mean(self.pdf_)
self.log_loss = -tf.reduce_mean(self.log_pdf_)
self.train_step = tf.train.AdamOptimizer().minimize(self.log_loss)
After Change
// since we operate with matrices not vectors, the output would have dimension (?,1)
// and therefor has to be reduce first to have shape (?,)
if self.data_normalization:
self.pdf_ = tf.squeeze(target_dist.prob(self.y_input) / tf.reduce_prod(self.std_y_sym), axis=1)
self.log_pdf_ = tf.squeeze(target_dist.log_prob(self.y_input) - tf.reduce_sum(tf.log(self.std_y_sym)), axis=1)
self.cdf_ = tf.squeeze(target_dist.cdf(self.y_input), axis=1)
else:
self.pdf_ = tf.squeeze(target_dist.prob(self.y_input), axis=1)
self.log_pdf_ = tf.squeeze(target_dist.log_prob(self.y_input), axis=1)
self.cdf_ = tf.squeeze(target_dist.cdf(self.y_input), axis=1)
self.loss = -tf.reduce_prod(self.pdf_)
self.log_loss = -tf.reduce_sum(self.log_pdf_)
self.train_step = tf.train.AdamOptimizer().minimize(self.log_loss)