使用 MathNet 在 C# 中计算给定指数的幂律分布
我目前正在开发一个项目,我需要生成多个值(最好是浮点数或双精度数),这些值遵循给定指数的幂律分布!
有人建议我使用 MathNet.Iridium 库来帮助我。我遇到的问题是文档并不像应该的那样明确(如果有的话)!
我看到多个分布符合幂律分布的一般概念,但我无法确定一个好的分布以某个指数作为参数使用。
有没有人在这方面有更多经验并可以给我一些提示或建议?
I am currently working on a project where I need to generate multiple values (floats or doubles preferably) that follow a power law distribution with a given exponent!
I was advised to use the MathNet.Iridium library to help me. The problem I have is that the documentation is not as explicit as it should be if there is any!
I see multiple distributions that fit the general idea of the power law distribution but I cannot pinpoint a good distribution to use with a certain exponent as a parameter.
Does anybody have more experience in that matter and could give me some hints or advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要生成您选择的分布值,您可以使用逆累积分布函数,如 维基百科。
一步一步,这看起来像:
Random
在这里会做得很好。结果是使用您选择的分布函数随机选择的值。
如果您在第 2 步中遇到问题,也许 https://mathoverflow.net/ 的人员可以帮助您。
编辑:如果您只需要具有指数伽马的幂律分布,这将生成一个值:
To generate values of a distribution of your choice, you could use the inverse cumulative distribution function, as mentioned in the wikipedia.
Step by step, this would look like:
Random
will do nicely here.The result is a value chosen at random using your chosen distribution function.
If you run into problems with step 2, maybe the folks at https://mathoverflow.net/ can help you.
Edit: If you just need any power law distribution with exponent gamma, this will generate one value: