lale icon indicating copy to clipboard operation
lale copied to clipboard

reuse common schemas in lale.lib.sklearn

Open hirzel opened this issue 4 years ago • 4 comments

Many operators in lale.lib.sklearn have similar schemas for fit, predict, transform, predict_proba, etc. Similarly, there are some hyperparameters that occur in many of the operators in lale.lib.sklearn, such as random_state, n_jobs, etc. We could make our code base smaller and easier to maintain by defining such schemas only once in a file imported by each of the operators, and then plugging them in at the right place.

We already do something like that for lale.lib.aif360:

  • schema reuse for fit and predict: https://github.com/IBM/lale/blob/1f0339748e907b33ccc58e51f5b31e3589026233/lale/lib/aif360/disparate_impact_remover.py#L120-L122
  • schema reuse for common hyperparameters: https://github.com/IBM/lale/blob/1f0339748e907b33ccc58e51f5b31e3589026233/lale/lib/aif360/disparate_impact_remover.py#L131 and https://github.com/IBM/lale/blob/1f0339748e907b33ccc58e51f5b31e3589026233/lale/lib/aif360/disparate_impact_remover.py#L138

hirzel avatar Mar 02 '21 19:03 hirzel

Started a file for this, only used by one operator so far: https://github.com/IBM/lale/blob/master/lale/lib/sklearn/_common_schemas.py

hirzel avatar Mar 18 '21 00:03 hirzel

tol is a good candidate for a shared parameter

shinnar avatar Nov 01 '22 13:11 shinnar

Did this for lale.lib.imblearn: https://github.com/IBM/lale/blob/master/lale/lib/imblearn/_common_schemas.py

hirzel avatar Jan 06 '23 15:01 hirzel

Did this for lale.lib.autoai_libs: https://github.com/IBM/lale/blob/master/lale/lib/autoai_libs/_common_schemas.py

shinnar avatar Feb 03 '23 14:02 shinnar