Uh oh!
There was an error while loading. Please reload this page.
Interval variables - adding two new exceptions - #8
Conversation
…al values; the stats fns are now executed against 'elemends' and no 'values'
…d only return when a single value is most common
eugene-eeo
commented
Aug 25, 2015
|
rodricios
commented
Aug 25, 2015
Would the statistics info I provided count as a good motivating factor for subclassing I personally see it similar to how stats.py subclasses on line 17: classStatisticsError(ValueError):
pass |
eugene-eeo
commented
Aug 25, 2015
But the name of |
rodricios
commented
Aug 25, 2015
Ah, I think I get what you're suggesting. So drop the extra subclass, but override the exception message? |
eugene-eeo
commented
Aug 25, 2015
Yup. See this SO question. Basically, try:
num()
exceptTypeErroraserr:
err.message='custom_message'raiseerr |
… the elements of the referencing class; used for checking if dist is 'discrete random variable'
Added
WrongVariableTypeError, MultipleMostCommonValuesError.WrongVariableTypeErroraddresses the fact that one cannot find the 'expectation' (mean) of a distribution of categorical (nominal) random variables (for example, a distribution of words is equivalent to a categorical variable).In other words, it makes no sense to find the average word.
From Foundations of Statistical Natural Language Processing - Manning and Schutze:
Where they define a random variable as being a...
The above quotes are taken from section 2.1.4 on Random Variables.
Unfortunately, the motivation behind
MultipleMostCommonValuesErroris not based off textbook definitions. Instead, it is based off the fact that we named our functionbest_pairin the singular.Oh, and test objects were simplified a bit.