tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
595 stars 88 forks source link

Document details on null_model #1009

Open jxu opened 1 year ago

jxu commented 1 year ago

https://parsnip.tidymodels.org/reference/null_model.html

There are several different plausible null models. For classification, besides predicting the majority class, there is also uniform random guessing, and selecting a class from a random input observation. See https://machinelearningmastery.com/how-to-develop-and-evaluate-naive-classifier-strategies-using-probability/

I'm not saying these need to be supported, but I had to look into the source code to see what is actually being fit. The source code clearly says "Fit a single mean or largest class model.", so this should be documented.

EmilHvitfeldt commented 1 year ago

Hello @jxu 👋

thanks for raising this issue, the documentation is indeed quite sparse

jxu commented 1 year ago

I can open a PR if you'd like. I assume https://github.com/tidymodels/parsnip/blob/907d2164a093f10cbbc1921e4b73264ca4053f6b/R/nullmodel.R#L1 is for nullmodel while https://github.com/tidymodels/parsnip/blob/907d2164a093f10cbbc1921e4b73264ca4053f6b/R/nullmodel.R#L128 is for null_model? The naming is a bit confusing.

EmilHvitfeldt commented 1 year ago

it is for the second one! https://github.com/tidymodels/parsnip/blob/HEAD/R/nullmodel.R#L128-L145

Yes the naming is a pain, but this is the only model that is define inside a parsnip package and making the names work with dispatch caused a bit of trouble.

if you are up for a PR go ahead!