Neuraxio / Neuraxle

The world's cleanest AutoML library ✨ - Do hyperparameter tuning with the right pipeline abstractions to write clean deep learning production pipelines. Let your pipeline steps have hyperparameter spaces. Design steps in your pipeline like components. Compatible with Scikit-Learn, TensorFlow, and most other libraries, frameworks and MLOps environments.
https://www.neuraxle.org/
Apache License 2.0
608 stars 62 forks source link

Rewriting of RecursiveDict, introduction of ExecutionPhase and ForceHandleIdentity #435

Closed vincent-antaki closed 3 years ago

vincent-antaki commented 3 years ago

Complete rewriting of RecursiveDict

The RecursiveDict suffered from a case of being poorly written. This lead to massive loss of time on flattening calls which were numerous and mostly superfluous in base.py (see #432). I re-wrote and simplified the whole data structure, add removed nearly all flatening calls. A few classes needed to be adapted to these modifications.

Introducing ExecutionPhase

We've had a case in one of our projects where we couldn't differentiate at run time between the computation of post-epoch training metric and production setup. The addition of ExecutionPhase aims at providing a simple way to define different phase-dependent behavior. ExecutionPhase is an enum with the following case : UNSPECIFIED, PRETRAIN, TRAIN , VALIDATION, TEST, PROD. By default, a context has an UNSPECIFIED ExecutionPhase.

We've added ExecutionPhaseSwitch and IfExecutionPhaseIsThenDo (should maybe renamed?) to handle simple case of phase-dependent behavior. (NOTE : IfExecutionPhaseIsThenDo is to be rewritten when we'll introduce the more abstract ExecuteIf class. Probably when I'll go through PR #319.)

To notice :

Introducing ForceHandleIdentity

There seems to be quite a few time we need a class which inherit from both ForceHandleMixin and Identity. We have now the ForceHandleIdentity class which does so and is ready to use.

Other modifications

vincent-antaki commented 3 years ago

@guillaume-chevalier I've applied the comments in the review and replied to the questions you had. This is ready to merge.