Skip to content

Commit

Permalink
Fix a bunch of typos
Browse files Browse the repository at this point in the history
Thanks to @abenseny.
  • Loading branch information
charmasaur committed Dec 18, 2020
1 parent bc172f2 commit cc77f09
Show file tree
Hide file tree
Showing 14 changed files with 340 additions and 339 deletions.
6 changes: 3 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ There are two example files for the differential evolution controller: *differen
:literal:


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

The Nelder Mead controller implements the `Nelder-Mead method <https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method>`_ for optimization. You can control the starting point and size of the initial simplex of the method with the configuration file.
The NelderMead controller implements the `NelderMead method <https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method>`_ for optimization. You can control the starting point and size of the initial simplex of the method with the configuration file.

There are two example files for the Nelder-Mead controller: *nelder_mead_simple_config.txt* which contains the basic options.
There are two example files for the NelderMead controller: *nelder_mead_simple_config.txt* which contains the basic options.

.. include:: ../examples/nelder_mead_simple_config.txt
:literal:
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ In the current example the region size is 2 by 2, with a trust region of 40% .
Thus the maximum allowed change for the second run will be [0 +/- 0.8, 0 +/- 0.8].
Alternatively you can provide a list of values for trust_region, which should have one entry for each parameter.
In that case each entry specifies the maximum change for the corresponding parameter.
When specified as a list, the elements are interpretted as the absolute amplitude of the change, *not* the change as a fraction of the allowed range.
When specified as a list, the elements are interpreted as the absolute amplitude of the change, *not* the change as a fraction of the allowed range.
Setting trust_region to [0.4, 0.4] would make the maximum allowed change for the second run be [0 +/- 0.4, 0 +/- 0.4].
Generally, specifying the trust_region is only needed if your experiment produces bad results when the parameters are changed significantly between runs.
Simply delete this keyword if your experiment works with any set of parameters within the boundaries.
Expand Down Expand Up @@ -271,7 +271,7 @@ The start of the script imports the libraries that are necessary for M-LOOP to w

.. literalinclude:: ../examples/python_controlled_experiment.py
:language: python
:end-before: #Declare your custom class that inherets from the Interface class
:end-before: #Declare your custom class that inherits from the Interface class

The first group of imports are just for python 2 compatibility. M-LOOP is targeted at python3, but has been designed to be bilingual. These imports ensure backward compatibility.

Expand Down
6 changes: 3 additions & 3 deletions docs/visualizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ 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.

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

As of yet there is no visualization class implemented for the Nelder Mead learner.
The controller's archive may still be plotted though when Nelder Mead is used.
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.

Random
------
Expand Down
2 changes: 1 addition & 1 deletion examples/nelder_mead_complete_config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Nelder-Mead Complete Options
#NelderMead Complete Options
#----------------------------

#General options
Expand Down
2 changes: 1 addition & 1 deletion examples/nelder_mead_simple_config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Nelder-Mead Basic Options
#NelderMead Basic Options
#-------------------------

#General options
Expand Down
2 changes: 1 addition & 1 deletion examples/python_controlled_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
import time

#Declare your custom class that inherets from the Interface class
#Declare your custom class that inherits from the Interface class
class CustomInterface(mli.Interface):

#Initialization of the interface, including this method is optional
Expand Down
2 changes: 1 addition & 1 deletion mloop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''
M-LOOP: Machine-Learning Online Optimization Packaage
M-LOOP: Machine-Learning Online Optimization Package
Python package for performing automated, online optimization of scientific experiments or anything that can be computer controlled. The package employs machine learning algorithms to rapidly find optimal parameters for systems under control.
Expand Down
24 changes: 12 additions & 12 deletions mloop/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_controller(interface,
controller_type (Optional [str]): Defines the type of controller can be 'random', 'nelder', 'gaussian_process' or 'neural_net'. Defaults to 'gaussian_process'.
**controller_config_dict : Options to be passed to controller.
Returns:
Controller : threadible object which must be started with start() to get the controller running.
Controller : threadable object which must be started with start() to get the controller running.
Raises:
ValueError : if controller_type is an unrecognized string
'''
Expand All @@ -60,7 +60,7 @@ def create_controller(interface,

class Controller():
'''
Abstract class for controllers. The controller controls the entire M-LOOP process. The controller for each algorithm all inherit from this class. The class stores a variety of data which all algorithms use and also all of the achiving and saving features.
Abstract class for controllers. The controller controls the entire M-LOOP process. The controller for each algorithm all inherit from this class. The class stores a variety of data which all algorithms use and also all of the archiving and saving features.
In order to implement your own controller class the minimum requirement is to add a learner to the learner variable. And implement the next_parameters method, where you provide the appropriate information to the learner and get the next parameters.
See the RandomController for a simple implementation of a controller.
Note the first three keywords are all possible halting conditions for the controller. If any of them are satisfied the controller will halt (meaning an and condition is used).
Expand All @@ -70,7 +70,7 @@ class Controller():
Keyword Args:
max_num_runs (Optional [float]): The number of runs before the controller stops. If set to float('+inf') the controller will run forever. Default float('inf'), meaning the controller will run until another condition is met.
target_cost (Optional [float]): The target cost for the run. If a run achieves a cost lower than the target, the controller is stopped. Default float('-inf'), meaning the controller will run until another condition is met.
max_num_runs_without_better_params (Otional [float]): Puts a limit on the number of runs are allowed before a new better set of parameters is found. Default float('inf'), meaning the controller will run until another condition is met.
max_num_runs_without_better_params (Optional [float]): Puts a limit on the number of runs are allowed before a new better set of parameters is found. Default float('inf'), meaning the controller will run until another condition is met.
controller_archive_filename (Optional [string]): Filename for archive. Contains costs, parameter history and other details depending on the controller type. Default 'ControllerArchive.mat'
controller_archive_file_type (Optional [string]): File type for archive. Can be either 'txt' a human readable text file, 'pkl' a python dill file, 'mat' a matlab file or None if there is no archive. Default 'mat'.
archive_extra_dict (Optional [dict]): A dictionary with any extra variables that are to be saved to the archive. If None, nothing is added. Default None.
Expand All @@ -88,10 +88,10 @@ class Controller():
out_params (list): List of all parameters sent out by controller.
out_extras (list): Any extras associated with the output parameters.
in_costs (list): List of costs received by controller.
in_uncers (list): List of uncertainties receieved by controller.
in_uncers (list): List of uncertainties received by controller.
best_cost (float): The lowest, and best, cost received by the learner.
best_uncer (float): The uncertainty associated with the best cost.
best_params (array): The best parameters recieved by the learner.
best_params (array): The best parameters received by the learner.
best_index (float): The run number that produced the best cost.
'''

Expand Down Expand Up @@ -148,7 +148,7 @@ def __init__(self, interface,
if isinstance(interface, mli.Interface):
self.interface = interface
else:
self.log.error('interface is not a Interface as defined in the MLOOP package.')
self.log.error('interface is not a Interface as defined in the M-LOOP package.')
raise TypeError

self.params_out_queue = interface.params_out_queue
Expand Down Expand Up @@ -366,7 +366,7 @@ def _shut_down(self):
self.end_learner.set()
self.log.debug('Interface end event set.')
self.end_interface.set()
#After 3 or 4 executions of mloop in same python environment, sometimes excution can be trapped here
#After 3 or 4 executions of mloop in same python environment, sometimes execution can be trapped here
#Likely to be a bug with multiprocessing in python, but difficult to isolate.
#current solution is to join with a timeout and kill if that fails
self.learner.join()
Expand Down Expand Up @@ -458,11 +458,11 @@ def _next_params(self):

class NelderMeadController(Controller):
'''
Controller for the Nelder-Mead solver. Suggests new parameters based on the Nelder-Mead algorithm. Can take no boundaries or hard boundaries. More details for the Nelder-Mead options are in the learners section.
Controller for the NelderMead solver. Suggests new parameters based on the NelderMead algorithm. Can take no boundaries or hard boundaries. More details for the NelderMead options are in the learners section.
Args:
params_out_queue (queue): Queue for parameters to next be run by experiment.
costs_in_queue (queue): Queue for costs (and other details) that have been returned by experiment.
**kwargs (Optional [dict]): Dictionary of options to be passed to Controller parent class and Nelder-Mead learner.
**kwargs (Optional [dict]): Dictionary of options to be passed to Controller parent class and NelderMead learner.
'''
def __init__(self, interface,
**kwargs):
Expand All @@ -476,7 +476,7 @@ def __init__(self, interface,

def _next_params(self):
'''
Gets next parameters from Nelder-Mead learner.
Gets next parameters from NelderMead learner.
'''
if self.curr_bad:
cost = float('inf')
Expand Down Expand Up @@ -522,7 +522,7 @@ class MachineLearnerController(Controller):
interface (Interface): The interface to the experiment under optimization.
**kwargs (Optional [dict]): Dictionary of options to be passed to Controller parent class and initial training learner.
Keyword Args:
training_type (Optional [string]): The type for the initial training source can be 'random' for the random learner, 'nelder_mead' for the Nelder-Mead learner or 'differential_evolution' for the Differential Evolution learner. This learner is also called if the machine learning learner is too slow and a new point is needed. Default 'differential_evolution'.
training_type (Optional [string]): The type for the initial training source can be 'random' for the random learner, 'nelder_mead' for the NelderMead learner or 'differential_evolution' for the Differential Evolution learner. This learner is also called if the machine learning learner is too slow and a new point is needed. Default 'differential_evolution'.
num_training_runs (Optional [int]): The number of training runs to before starting the learner. If None, will be ten or double the number of parameters, whatever is larger.
no_delay (Optional [bool]): If True, there is never any delay between a returned cost and the next parameters to run for the experiment. In practice, this means if the machine learning learner has not prepared the next parameters in time the learner defined by the initial training source is used instead. If false, the controller will wait for the machine learning learner to predict the next parameters and there may be a delay between runs.
'''
Expand Down Expand Up @@ -613,7 +613,7 @@ def _update_controller_with_machine_learner_attributes(self):

def _put_params_and_out_dict(self, params):
'''
Override _put_params_and_out_dict function, used when the training learner creates parameters. Makes the defualt param_type the training type and sets last_training_run_flag.
Override _put_params_and_out_dict function, used when the training learner creates parameters. Makes the default param_type the training type and sets last_training_run_flag.
'''
super(MachineLearnerController,self)._put_params_and_out_dict(params, param_type=self.training_type)
self.last_training_run_flag = True
Expand Down
4 changes: 2 additions & 2 deletions mloop/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run(self):

def get_next_cost_dict(self,params_dict):
'''
Abstract method. This is the only method that needs to be implemented to make a working interface. Given the parameters the interface must then produce a new cost. This may occur by running an experiment or program. If you wish to abruptly end this interface for whatever rease please raise the exception InterfaceInterrupt, which will then be safely caught.
Abstract method. This is the only method that needs to be implemented to make a working interface. Given the parameters the interface must then produce a new cost. This may occur by running an experiment or program. If you wish to abruptly end this interface for whatever reason please raise the exception InterfaceInterrupt, which will then be safely caught.
Args:
params_dict (dictionary): A dictionary containing the parameters. Use params_dict['params'] to access them.
Expand All @@ -133,7 +133,7 @@ class FileInterface(Interface):
Keyword Args:
interface_out_filename (Optional [string]): filename for file written with parameters.
interface_in_filename (Optional [string]): filename for file written with parameters.
interface_file_type (Optional [string]): file type to be written either 'mat' for matlab or 'txt' for readible text file. Defaults to 'txt'.
interface_file_type (Optional [string]): file type to be written either 'mat' for matlab or 'txt' for readable text file. Defaults to 'txt'.
'''

def __init__(self,
Expand Down
Loading

0 comments on commit cc77f09

Please sign in to comment.