using mlxtend with statsmodels #953
Replies: 2 comments 1 reply
-
I think the challenge here is that I haven't thought about this too deeply, but it could be possible to generate a custom scorer function that supports that, but this would be very specific to the model and take some work (https://scikit-learn.org/stable/modules/generated/sklearn.metrics.make_scorer.html#sklearn.metrics.make_scorer) There do seem to be some specialized implementations of certain models that support AIC and BIC, and the exhaustive feature selection could be applied as an outer loop to those https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoLarsIC.html#sklearn.linear_model.LassoLarsIC |
Beta Was this translation helpful? Give feedback.
-
I think - and please correct me if I'm wrong - if mlxtend was able to use models from the Statsmodels library as well, instead of just Scikit-learn, then using AIC, BIC, etc would be trivial, since Statsmodels tends to compute those values for free, it's just an attribute in the fitted model. Combining that with the Formula models in The main thing here is how and when you pass data into the model - Statsmodels and Scikit-learn differ quite a bit, the former wants data from the very moment you define the model, while the latter only requires data when you call |
Beta Was this translation helpful? Give feedback.
-
I want to do in Python things that are trivial to do in R. For example, search for the best model, perhaps using
ExhaustiveFeatureSelector()
, but using AIC or BIC as the search criteria.statsmodels calculate AIC and BIC by default for their models, and expose them as attributes. That would simplify things a lot.
Beta Was this translation helpful? Give feedback.
All reactions