You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Cowan (JIRA)" <ji...@apache.org> on 2008/01/21 01:32:35 UTC
[jira] Updated: (MATH-178) Implement Zipf distribution
[ https://issues.apache.org/jira/browse/MATH-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Cowan updated MATH-178:
----------------------------
Attachment: ZipfDistribution.patch
OK, patch attached. I've based the layout, commenting, test case etc. on Binomial and Poisson distributions. A few points for discussion here:
1) I haven't added a method to DistributionFactory; as this is deprecated I assume that this is not required. I have, however, kept to the ___Distribution and ____DistributionImpl convention.
2) Test case has been produced by running some figures through an openoffice spreadsheet to generate the 4-decimal-place results; happy to attach this spreadsheet too if someone wants to check my workings for producing the test data.
3) Javadoc may need improvement; haven't touched the xdocs either (the distribution-related xdocs specifically refer to those creatable by DistributionFactory, so this may need to be changed if #1 is not correct)
4) The biggest 'hole' is in ZipfDistributionImpl.generalizedHarmonic. Firstly, this is (probably) a useful enough utility function that it could be used elsewhere and should live in its own method in either its own or another appropriate class; I'd like some guidance here. Secondly, this will obviously perform poorly as it's a simple iteration loop. If someone is able to optimise this, great; if not, at the very least we could save a fair bit of work by caching the value of generalizedHarmonic(numberOfElements, exponent) whenever either value is changed; this would make probability(x) lightning-quick and would at least speed up cumulativeProbability by >50%. If no-one can work out how to generate the harmonics more quickly (I know *I* can't!) we could even cache any values <= numberOfElements in an array; calculating those beyond where we've already worked out would then obviously be a lot quicker. Any other help or techniques gratefully accepted.
Keen to see what people think.
> Implement Zipf distribution
> ---------------------------
>
> Key: MATH-178
> URL: https://issues.apache.org/jira/browse/MATH-178
> Project: Commons Math
> Issue Type: New Feature
> Reporter: Paul Cowan
> Priority: Minor
> Attachments: ZipfDistribution.patch
>
>
> Per my post to commons-dev -- http://mail-archives.apache.org/mod_mbox/commons-dev/200801.mbox/%3c478EDFEB.3010902@funkwit.com%3e -- I'd like to propose adding a Zipf distribution to commons-math.
> I have a patch, but it's incomplete and somewhat inefficient; I'd like to throw it up for discussion though. To follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.