示例#1
0
def test_student_t(x, mean, scale, df):
    def c(val):
        return tf.cast(val, default_float())

    gpf = logdensities.student_t(c(x), c(mean), c(scale), df).numpy()
    sps = scipy.stats.t(df=df, loc=mean, scale=scale).logpdf(x)
    np.testing.assert_allclose(gpf, sps)
示例#2
0
 def logp(self, F, Y):
     return logdensities.student_t(Y, F, self.scale, self.df)
示例#3
0
def test_student_t(x, mean, scale, df):
    cast = to_default_float
    gpf = logdensities.student_t(cast(x), cast(mean), cast(scale), df).numpy()
    sps = scipy.stats.t(df=df, loc=mean, scale=scale).logpdf(x)
    np.testing.assert_allclose(gpf, sps)