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
|
|
|
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: class StatisticsError(ValueError):
pass |
|
But the name of |
|
Ah, I think I get what you're suggesting. So drop the extra subclass, but override the exception message? |
|
Yup. See this SO question. Basically, try:
num()
except TypeError as err:
err.message = 'custom_message'
raise err |
… 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.