You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have a predefined list of supported regressor and selector objects, which can be accessed via the --regressor <regressor> and --selector <selector> CLI options. This approach restricts users to the ones we decided to include. It also means that if an object is added or deprecated in a future scikit-learn release, we will have to break compatibility between releases, or perform some gymnastics to support both.
I propose the following. We allow users to provide the name of any object to use as a regressor/selector, e.g. --regressor sklearn.linear_model.LassoCV. The following self-contained code snippet demonstrates how we might implement this.
fromimportlibimportimport_module# that's a mouthful# this will be the `args` object that already exists in `plotypus.cli.get_args`fromargparseimportNamespaceargs=Namespace(regressor="sklearn.linear_model.LassoCV")
# separate module and object nameregressor_components=args.regressor.split(".")
regressor_module_name=".".join(regressor_components[:-1])
regressor_object_name=regressor_components[-1]
# import the module and then the regressor object from itregressor_module=import_module(regressor_module_name)
regressor_object=getattr(regressor_module, regressor_object_name)
This functionality could of course be wrapped in a utility function (perhaps plotypus.utils.import_object) for reuse on the selector and possibly other objects, but this makes for a nice demonstration.
The choice still remains to include some shortcuts like we already do, such as having LassoCV be a shortcut for sklearn.linear_model.LassoCV. This could be taken care of by a check like
One caveat: our current implementation of Baart's criteria will not work here. It will have to be refactored as a legitimate selector object, as I had originally envisioned it, instead of an option to plotypus.preprocessing.Fourier. This is something I planned on doing eventually, anyway, so it's not a real issue.
Currently we have a predefined list of supported regressor and selector objects, which can be accessed via the
--regressor <regressor>
and--selector <selector>
CLI options. This approach restricts users to the ones we decided to include. It also means that if an object is added or deprecated in a future scikit-learn release, we will have to break compatibility between releases, or perform some gymnastics to support both.I propose the following. We allow users to provide the name of any object to use as a regressor/selector, e.g.
--regressor sklearn.linear_model.LassoCV
. The following self-contained code snippet demonstrates how we might implement this.This functionality could of course be wrapped in a utility function (perhaps
plotypus.utils.import_object
) for reuse on the selector and possibly other objects, but this makes for a nice demonstration.The choice still remains to include some shortcuts like we already do, such as having
LassoCV
be a shortcut forsklearn.linear_model.LassoCV
. This could be taken care of by a check likeI think we should definitely go ahead with the new functionality, the only thing I'm iffy on is keeping the old functionality. Thoughts?
The text was updated successfully, but these errors were encountered: