-
Notifications
You must be signed in to change notification settings - Fork 296
【Hackathon 6th No.6】Update StudentT API rfcs #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| t 分布的 cdf 与 icdf 主要是在统计学的假设检验问题中有重要价值, 而在机器学习的概率模型领域下,使用最为广泛的主要还是分布的 pdf 与 logpdf。另一方面由于 t 分布的 cdf 和 icdf 的实现相对复杂, 对 pdf 的积分函数与其积分函数的逆函数的实现需要借助 [incomplete beta function](https://dlmf.nist.gov/8.17) 和 inverse incomplete beta function,这两个在 paddle 中尚未实现,所以考虑暂时先不实现 cdf 与 icdf。 | ||
|
|
||
| 此外, kl 散度的解析函数较难推导出, 以下过程参考[A Novel Kullback-Leilber Divergence Minimization-Based Adaptive Student's t-Filter](https://www.researchgate.net/publication/335580775_A_Novel_Kullback-Leilber_Divergence_Minimization-Based_Adaptive_Student's_t-Filter) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/distributions/student_t.py#L780-L1079 tf中也并没有为t分布实现kl逻辑。而是在https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/distributions/distribution.py#L1730-L1761 中调用return kullback_leibler.kl_divergence(self, other, allow_nan_stats=self.allow_nan_stats)实现,你可以看看padldle 中的paddle.distribution.kl_divergence(p, q) https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/kl_divergence_cn.html 是否能满足要求,因此也不需要单独为t分布实现kl。 刚才看了 下RFC对于一些符号的解释并没有在第一时间解释,比如Gamma函数的在此处第一次出现但是没有立刻解释,可以调整一下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

tf 中的 kullback_leibler.kl_divergence(self, other, allow_nan_stats=self.allow_nan_stats) 根据他的文档注释应该意思是如果该分布没有直接实现kl_divergence,就去找父类有没有实现。padldle 中的 paddle.distribution.kl_divergence(p, q) 也是类似的逻辑。所以应该还是没办法实现t分布的kl。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
符号解释已调整
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,没有问题。kl本次开发不涉及。
| D_{KL} & = \log \Gamma(\frac{\nu_1+1}{2}) - \log \Gamma(\frac{\nu_2+1}{2}) + \frac{1}{2}\log\frac{\nu_2}{\nu_1} + \log\frac{\sigma_2}{\sigma_1} - \log\Gamma(\frac{\nu_1}{2}) + \log\Gamma(\frac{\nu_2}{2}) \\ | ||
| & - \frac{\nu_1+1}{2} [\psi(\frac{1+\nu_1}{2}) - \psi(\frac{\nu_1}{2})] \\ | ||
| & + \frac{\nu_2+1}{2} \mathbb{E}\_{f1(x)}\[\log[1 +(\frac{x-\mu_2}{\sigma_2})^2 / \nu_2]\] | ||
| \end{aligned} $$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该指明哪一项无法解析,看你的推导应该是最后一项无法解析,应该是只能利用不等式推出上确界,可以在RFC中补充下,更方便大家理解。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
|
LGTM |
之前 kl 散度的推导有误,建议先不实现 kl 散度。