neuraxle.plotting

Notebook matplotlib plotting functions

Utility function for plotting in notebooks.

Functions

plot_distribution_space(hyperparameter_space)

plot_histogram(title, distribution[, num_bins])

plot_pdf_cdf(title, distribution)

Classes

TrialMetricsPlottingObserver(…)

An observer that receives trial updates and plots metric results.

class neuraxle.plotting.TrialMetricsPlottingObserver(plotting_folder_name: str = 'metric_results', save_plots: bool = True, plot_trial_on_next: bool = True, plot_all_trials_on_complete: bool = True, plot_individual_trials_on_complete: bool = True)[source]

An observer that receives trial updates and plots metric results. It can plot individual trials on each update, or upon completion. It can also plot all trials in the same plot upon completion.

Usage Example:

hyperparams_repository: HyperparamsJSONRepository = HyperparamsJSONRepository(cache_folder='trials')
hyperparams_repository.subscribe(TrialMetricsPlottingObserver(
    plotting_folder_name: str = 'metric_results',
    plot_individual_trials_on_complete=False,
    plot_trial_on_next=True,
    plot_all_trials_on_complete=False,
    save_plots=True
))

auto_ml = AutoML(
    pipeline,
    n_trials=n_iter,
    validation_split_function=validation_splitter(0.2),
    hyperparams_optimizer=RandomSearchHyperparameterSelectionStrategy(),
    scoring_callback=ScoringCallback(mean_squared_error, higher_score_is_better=False),
    callbacks=[
        MetricCallback('mse', metric_function=mean_squared_error, higher_score_is_better=False)
    ],
    refit_trial=True,
    cache_folder_when_no_handle=str(tmpdir)
)

auto_ml = auto_ml.fit(data_inputs, expected_outputs)

See also

_Observer, Trial, Trials, AutoML, HyperparamsRepository, HyperparamsJSONRepository

_abc_cache = <_weakrefset.WeakSet object>[source]
_abc_generic_negative_cache = <_weakrefset.WeakSet object>[source]
_abc_generic_negative_cache_version = 60
_abc_registry = <_weakrefset.WeakSet object>[source]
_gorg[source]

alias of TrialMetricsPlottingObserver

_plot_all_trial_main_and_validation_metric_results(repo, trial)[source]
_plot_all_trials_on_complete(repo, trials)[source]
_plot_all_trials_training_results_for_metric(trials, metric_name, cache_folder, split_number)[source]
_plot_all_trials_validation_results_for_metric(trials, metric_name, cache_folder, split_number)[source]
_show_or_save_plot(plotting_file)[source]
on_complete(value: neuraxle.metaopt.auto_ml.HyperparamsRepository)[source]

Plot trial metric results upon completion.

Parameters

value – hyperparams_repository, trial

Returns

on_next(value: Tuple[neuraxle.metaopt.auto_ml.HyperparamsRepository, neuraxle.metaopt.trial.Trial])[source]

Plot updated trial metric results.

Parameters

value – hyperparams_repository, trial

Returns

neuraxle.plotting.plot_distribution_space(hyperparameter_space: neuraxle.hyperparams.space.HyperparameterSpace, num_bins=50)[source]
neuraxle.plotting.plot_histogram(title: str, distribution: neuraxle.hyperparams.distributions.HyperparameterDistribution, num_bins=50)[source]
neuraxle.plotting.plot_pdf_cdf(title: str, distribution: neuraxle.hyperparams.distributions.HyperparameterDistribution)[source]