예제 #1
0
    def _forward_log_det_jacobian(self, x):
        # y = sinh((arcsinh(x) + skewness) * tailweight) * multiplier
        # Using sinh' = cosh, arcsinh'(x) = 1 / sqrt(x**2 + 1),
        # dy/dx
        # = cosh((arcsinh(x) + skewness) * tailweight) * tailweight / sqrt(x**2 + 1)
        # * multiplier

        tailweight = tf.convert_to_tensor(self.tailweight)

        return (tfp_math.log_cosh((tf.asinh(x) + self.skewness) * tailweight) -
                0.5 * tfp_math.log1psquare(x) + tf.math.log(tailweight) +
                tf.math.log(self._output_multiplier(tailweight)))
예제 #2
0
    def _inverse_log_det_jacobian(self, y):
        # x = sinh(arcsinh(y / multiplier) / tailweight - skewness)
        # Using sinh' = cosh, arcsinh'(y) = 1 / sqrt(y**2 + 1),
        # dx/dy
        # = cosh(arcsinh(y / multiplier) / tailweight - skewness)
        #     / (tailweight * sqrt((y / multiplier)**2 + 1)) / multiplier

        tailweight = tf.convert_to_tensor(self.tailweight)
        multiplier = self._output_multiplier(tailweight)
        y = y / multiplier

        return (tfp_math.log_cosh(tf.asinh(y) / tailweight - self.skewness) -
                0.5 * tfp_math.log1psquare(y) - tf.math.log(tailweight) -
                tf.math.log(multiplier))
예제 #3
0
 def _forward_log_det_jacobian(self, x):
     return tfp_math.log_cosh(x)