Skip to content
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

柯西分布设计文档提交 #362

Closed
wants to merge 8 commits into from

Conversation

lwbmowgli
Copy link

柯西设计文档提交

@paddle-bot
Copy link

paddle-bot bot commented Feb 20, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@lwbmowgli
Copy link
Author

@cxxly 文档还有其他问题吗?如无是否可以合入了?另外,几何分布的PR也提交在这里了。

增加 API `paddle.distribution.Cauchy`,Cauchy 用于 Cauchy 分布的概率统计与随机采样。API具体包含如下方法:

功能:`Creates a Laplace distribution parameterized by loc and scale.`

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cauchy

- 调研 Paddle 及业界实现惯例,并且代码风格及设计思路与已有概率分布保持一致代码,需采用飞桨2.0之后的API,故依赖飞桨版本V2.4.2 。

- PS:已经参与Laplace的API贡献,故此部分较为熟悉。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cauchy


测试Cauchy分布的特性

测试方法:该部分主要测试分布的均值、方差、熵等特征。类TestLaplace继承unittest.TestCase,分别实现方法setUp(初始化),test_mean(mean单测),test_variance(variance单测),test_stddev(stddev单测),test_entropy(entropy单测),test_sample(sample单测)。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestCauchy

测试方法:该部分主要测试分布的均值、方差、熵等特征。类TestLaplace继承unittest.TestCase,分别实现方法setUp(初始化),test_mean(mean单测),test_variance(variance单测),test_stddev(stddev单测),test_entropy(entropy单测),test_sample(sample单测)。

考虑到柯西分布的特殊性:数学期望与方差均不存在
均值、方差等通过Numpy计算相应值(inf,nan),对比Laplace类中相应property的返回值,若一致即正确;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cauchy


- 目前 飞桨没有 API `paddle.distribution.Geometric`,

- 调研 Paddle 及业界实现惯例,并且代码风格及设计思路与已有概率分布保持一致代码,需采用飞桨2.0之后的API,故依赖飞桨版本V2.4.2 。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保持一致


- TensorFlow 的 API 与 PyTorch 的设计思路不同,本API开发主要参考pytorch的实现逻辑,参照tensorflow。
- TensorFlow 的 API 中包含KL散度的注册,在飞桨的实现中将参考这一实现与之前拉普拉斯分布中的实现。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对比分析的目的,是让大家调研业界思路,总结出不同方案的优缺点,针对Paddle现有情况,做出最佳设计选择,从这个角度出发,此处对比分析并没有达到想要的效果;建议最好能展开具体分析TF/Torch/Numpy(Scipy)异同及原因,分析出优缺点,针对Paddle现状做出最佳设计。

可能由于部分API比较简单,对比结果基本一致,但过程是必不可少的,会帮助大家发现一些设计/实现上问题,比如TFP的有些实现考虑了数值稳定性、而Torch并没有考虑

@cxxly
Copy link

cxxly commented Feb 28, 2023

修改PR标题,和内容对应上,内容包含了柯西分布、几何分布

@Zheng-Bicheng
Copy link
Contributor

大佬,RFC本身就是设计文档,是可以提交多个的。并不是说别人的RFC通过,你就不能再接着做这题了,往届甚至还有接着别的同学的RFC往下做的。难道一个RFC提到了单测案例,另一个RFC就不能用了吗,那怎么才能进行充分测试呢?这本身并不影响比赛的公平公正呀。只要代码不雷同就好了吧?

@lwbmowgli
Copy link
Author

@Zheng-Bicheng 不仅仅是单测案例,参考了我能理解,但是随机采样30000怎么就是纯属巧合了呢?引用了第三期哪个指出来对吧,看看那个RFC是不是也是我写的?另外,我觉得规则上有写:4、产生任务 leader:第一个通过设计文档评审的开发者将成为该任务的 leader,后续任务开发需按照设计文档进行;若其他开发者先于任务 leader 提交了作品,则他/她的作品需经过任务 leader 的确认(自@任务leader review 后,7个自然日内无回复默认通过),未按照设计文档开发的作品将不会进入评审阶段。这是否会产生偏见?我的代码是否又会被巧合?

@luotao1
Copy link
Collaborator

luotao1 commented Mar 16, 2023

close due to the following PR is merged

@luotao1 luotao1 closed this Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants