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

Feature: HyperparametersSamples print in AutoML should exclude steps with no hyperparameter. #489

Closed vincent-antaki closed 2 years ago

vincent-antaki commented 3 years ago

At the moment, we print the hyperparameters sample by using a json dump of the dictionnary.

def _get_trial_split_description(
        repo_trial: Trial,
        repo_trial_split_number: int,
        validation_splits: List[Tuple[DataContainer, DataContainer]],
        trial_number: int,
        n_trial: int
):
    trial_split_description = '{}/{} split {}/{}\nhyperparams: {}'.format(
        trial_number + 1,
        n_trial,
        repo_trial_split_number + 1,
        len(validation_splits),
        json.dumps(repo_trial.hyperparams, sort_keys=True, indent=4)
    )
    return trial_split_description

Which yield results such as :

hyperparams: {
    "FeatureUnion": {
        "NumpyMax": {},
        "NumpyMean": {},
        "NumpyMedian": {},
        "NumpyMin": {},
        "Pipeline": {
            "FeatureUnion": {
                "FFTPeakBinWithValue": {},
                "NumpyFlattenDatum": {},
                "joiner": {}
            },
            "NumpyAbs": {},
            "NumpyFFT": {}
        },
        "joiner": {}
    },
    DecisionTreeClassifier": {
        "ccp_alpha": 0.0,
        "class_weight": null,
        "criterion": "gini",
        "max_depth": null,
        "max_features": null,
        "max_leaf_nodes": null,
        "min_impurity_decrease": 0.0,
        "min_impurity_split": null,
        "min_samples_leaf": 5,
        "min_samples_split": 0.5,
        "min_weight_fraction_leaf": 0.0,
        "random_state": null,
        "splitter": "random"
        },
    "TrainOnlyWrapper": {
        "NumpyShapePrinter": {}
    }
}

I'd like a more elaborate, recursive, function which returns a string containing only the steps hierarchies which contains hyperparameters.