Skip to content

Commit

Permalink
Merge pull request #140 from zakv/dummy-visualizers
Browse files Browse the repository at this point in the history
Fix `show_all_default_visualizations()` for random and Nelder-Mead learners.
  • Loading branch information
zakv authored Jun 13, 2022
2 parents aa4099e + 6ac18b6 commit 96a7a1f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/visualizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ Differential Evolution
This plot displays the measured costs for each generation.
Because there are multiple runs per generation, there are many different values for the cost plotted for each generation.

NelderMead
Nelder-Mead
-----------

As of yet there is no visualization class implemented for the NelderMead learner.
The controller's archive may still be plotted though when NelderMead is used.
As of yet there are no visualizations implemented for the Nelder-Mead learner.
The controller's archive may still be plotted though when Nelder-Mead is used.

Random
------

As of yet there is no visualization class implemented for the random learner.
As of yet there are no visualizations implemented for the random learner.
The controller's archive may still be plotted though when the random controller is used.

Reproducing visualizations
Expand Down
2 changes: 2 additions & 0 deletions mloop/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ def get_controller_type_from_learner_archive(learner_filename):
'gaussian_process_learner': 'gaussian_process',
'neural_net_learner': 'neural_net',
'differential_evolution': 'differential_evolution',
'random_learner': 'random',
'nelder_mead_learner': 'nelder_mead',
}
if archive_type in ARCHIVE_CONTROLLER_MAPPING:
controller_type = ARCHIVE_CONTROLLER_MAPPING[archive_type]
Expand Down
45 changes: 44 additions & 1 deletion mloop/visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,17 @@ def create_learner_visualizer_from_archive(filename, controller_type=None, **kwa
log.debug('Creating neural net visualizer.')
visualizer = NeuralNetVisualizer(filename, **kwargs)
elif controller_type == 'gaussian_process':
log.debug('Creating gaussian process visualizer.')
log.debug('Creating Gaussian process visualizer.')
visualizer = GaussianProcessVisualizer(filename, **kwargs)
elif controller_type == 'differential_evolution':
log.debug('Creating differential evolution visualizer.')
visualizer = DifferentialEvolutionVisualizer(filename, **kwargs)
elif controller_type == 'random':
log.debug('Creating random visualizer.')
visualizer = RandomVisualizer(filename, **kwargs)
elif controller_type == 'nelder_mead':
log.debug('Creating Nelder-Mead visualizer.')
visualizer = NelderMeadVisualizer(filename, **kwargs)
else:
message = ('create_learner_visualizer_from_archive() not implemented '
'for type: {type_}.').format(type_=controller_type)
Expand Down Expand Up @@ -599,6 +605,43 @@ def plot_parameters_vs_cost(self, parameter_subset=None):
)
plt.legend(artists, legend_labels ,loc=legend_loc)


class RandomVisualizer:
'''
Visualization class for the random learner.
Currently no learner plots are generated for the random learner. However,
controller visualizations may still be generated.
'''
def __init__(self, filename, file_type=None, **kwargs):
pass

def create_visualizations(self, *args, **kwargs):
log = logging.getLogger(__name__)
log.warning(
"No visualizations are currently implemented for the random "
"learner."
)


class NelderMeadVisualizer:
'''
Visualization class for the Nelder-Mead learner.
Currently no learner plots are generated for the Nelder-Mead learner.
However, controller visualizations may still be generated.
'''
def __init__(self, filename, file_type=None, **kwargs):
pass

def create_visualizations(self, *args, **kwargs):
log = logging.getLogger(__name__)
log.warning(
"No visualizations are currently implemented for the Nelder-Mead "
"learner."
)


def create_differential_evolution_learner_visualizations(filename,
file_type=None,
**kwargs):
Expand Down

0 comments on commit 96a7a1f

Please sign in to comment.