[issue28956] return list of modes for a multimodal distribution instead of raising a StatisticsError
Srikanth Anantharam added the comment: Please review the new PR with tests. I'll update the documentation if the PR is acceptable. -- title: return minimum of modes for a multimodal distribution instead of raising a StatisticsError -> return list of modes for a multimodal distribution instead of raising a StatisticsError ___ Python tracker <https://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Change by Srikanth Anantharam : -- keywords: +patch pull_requests: +5512 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Srikanth Anantharam added the comment: @steven: data = [1, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9] is clearly unimodal with mode 8 data would have been bimodal if 4 repeated exactly the same (7) number of times as 8, like this: data = [1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9] in which case the new patch in PR 50 would return a tuple (4, 8) Thanks & Regards Srikanth Anantharam +91 7204 350429 https://sria91.github.io/ Sent from Android On 13-Dec-2016 3:24 PM, "Steven D'Aprano" wrote: Steven D'Aprano added the comment: On Tue, Dec 13, 2016 at 09:35:22AM +0000, Srikanth Anantharam wrote: > > Srikanth Anantharam added the comment: > > A better choice would be to return a tuple of values (sliced from the > table). And let the user decide which one to use. The current mode() function is designed for a very basic use-case, where you have an obvious single mode from discrete data. The problem with dealing with multiple modes is that its not easy to tell the difference between a genuinely multi-modal sample and one which just happens to have a few samples with the same value: data = [1, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9] Assuming the sampling is fair, 8 is clearly the mode; but is it bimodal with 4 the second mode? Or perhaps even four modes, 8, 4, 7 and 9? I have plans for introducing a binning function to collect data into bins and run statistics on the bins. That might be a better way to deal with multi-modal samples: if you bin the data (for discrete data, use a bin size of 1) and then look at the frequencies, you can decide how many modes there are. Thanks for the suggestion. -- ___ Python tracker <http://bugs.python.org/issue28956> ___ -- ___ Python tracker <http://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Srikanth Anantharam added the comment: Please see the updated pull request PR 50, with the changes. Thanks & Regards Srikanth Anantharam +91 7204 350429 https://sria91.github.io/ Sent from Android On 13-Dec-2016 3:26 PM, "Srikanth Anantharam" wrote: > > Changes by Srikanth Anantharam : > > > -- > pull_requests: +4 > > ___ > Python tracker > <http://bugs.python.org/issue28956> > ___ > -- ___ Python tracker <http://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Changes by Srikanth Anantharam : -- pull_requests: +4 ___ Python tracker <http://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Srikanth Anantharam added the comment: A better choice would be to return a tuple of values (sliced from the table). And let the user decide which one to use. Hope that's justifiable... Thanks & Regards Srikanth Anantharam +91 7204 350429 https://sria91.github.io/ Sent from Android On 13-Dec-2016 2:20 PM, "Wolfgang Maier" wrote: > > Wolfgang Maier added the comment: > > What's the justification for this proposed change? Isn't it better to > report the fact that there isn't an unambiguous result instead of returning > a rather arbitrary one? > > -- > nosy: +steven.daprano, wolma > versions: +Python 3.7 -Python 3.5 > > ___ > Python tracker > <http://bugs.python.org/issue28956> > ___ > -- ___ Python tracker <http://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
New submission from Srikanth Anantharam: return minimum of modes for a multimodal distribution instead of raising a StatisticsError -- components: Library (Lib) messages: 283071 nosy: Srikanth Anantharam priority: normal pull_requests: 3 severity: normal status: open title: return minimum of modes for a multimodal distribution instead of raising a StatisticsError type: behavior versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue28956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com