-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interval variables - adding two new exceptions #8
base: master
Are you sure you want to change the base?
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
.WrongVariableTypeError
addresses 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
MultipleMostCommonValuesError
is not based off textbook definitions. Instead, it is based off the fact that we named our functionbest_pair
in the singular.Oh, and test objects were simplified a bit.