def student_t(x, mean, scale, deg_free):
const = tf.lgamma(tf.cast((deg_free + 1.) * 0.5, settings.float_type))\
- tf.lgamma(tf.cast(deg_free * 0.5, settings.float_type))\
- 0.5*(tf.log(tf.square(scale)) + tf.cast(tf.log(deg_free), settings.float_type)
+ np.log(np.pi))
const = tf.cast(const, settings.float_type)
return const - 0.5*(deg_free + 1.) * \
tf.log(1. + (1. / deg_free) * (tf.square((x - mean) / scale)))
评论列表
文章目录