brownplt / code.pyret.org

Website for serving Pyret to folks.
Other
24 stars 44 forks source link

modes should work for categorical data #510

Closed schanzer closed 2 months ago

schanzer commented 5 months ago

In the Statistics package, modes throws an internal error when used with non-numeric data. At the very least, this should be a better error! But more importantly, modes are not restricted to numbers. (This has some implications for our treatment of the topic in Bootstrap:DS -- right now we give a falsely narrow definition simply because Pyret doesn't support the full definition)

asolove commented 4 months ago

Started looking at this one, some notes so I don't forget when I come back to this:

asolove commented 4 months ago

Related discussion over in pyret-lang, mostly around actually enforcing the type constraint and showing a nicer error, rather than extending these to other types: https://github.com/brownplt/pyret-lang/issues/1538

schanzer commented 4 months ago

@asolove oh wow - really interesting to see that thread. I didn't realize this came up 2 years ago! In that case, maybe the solution is just a written-in-pyret-function that lives in our Data Science library. Would you be willing to write one?

asolove commented 4 months ago

Yeah, we could definitely do that. Can you point me to the Data Science library?

schanzer commented 4 months ago

Here's the link - I'm sure I'm not doing the most elegant stuff, so any advice you have on coding quality is most welcome!

asolove commented 4 months ago

Gonna close this out as the resolution won't be in the CPO codebase. But it's still on my backlog list so I'll write some suggested changes to that file and share with you.

blerner commented 2 months ago

Closing this as dupe of https://github.com/brownplt/pyret-lang/issues/1538, since the discussion there is further along.