Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve training archive loading #90

Merged
merged 7 commits into from
Dec 22, 2020

Conversation

zakv
Copy link
Collaborator

@zakv zakv commented Dec 19, 2020

Makes more progress towards resolving all of the problems mentioned in #82. Fully resolves #82

In particular the GaussianProcessLearner and NeuralNetLearner can now use each other's archives as training archives. They still can't use archives from the DifferentialEvolutionLearner, and possibly the other learners as well. The GaussianProcessLearner and NeuralNetLearner can now use a learner archive from any type of learner as their training archive. Note that it won't be possible for them to use old archives from other types of learners; they can only load archives from other types of learners if those optimizations were run with the changes included in this PR.

Changes proposed in this pull request:

  • Add ability for GaussianProcessLearner and NeuralNetLearner to use learner archives from other types of learners as training archives.
  • Always load basic data common to all optimizations, e.g. all_costs and all_params.
    • The NelderMeadLearner, DifferentialEvolutionLearner, and RandomLearner have been modified to save these parameters to their archives; hence why their archives from old optimization runs won't work here.
    • In the process of implementing this, the messages from the controllers to their learners have all been standardized so that they all send the same information. All controllers now send params, cost, uncer, and bad to their learners.
    • All learners now have the self.all_params, self.all_costs, self.all_uncers, and self.bad_run_indexs properties.
    • RandomLearner now keeps track of its best parameters on its own since its controller doesn't send them anymore.
    • RandomLearner now saves a learner archive by default
  • Some refactoring of shared code
  • Update docstrings

Overall approach:

  • Error out if num_params in the new optimization doesn't match num_params in the archive.
    • If num_params is None and a training archive is provided, then it will default to the value of num_params in the training archive. This is needed for the visualization class so that it can call its parent's __init__() method without knowing num_params ahead of time.
  • Always load basic data common to all optimizations
  • Load hyperparameter values and histories from the previous optimization if it used the same learner, otherwise ignore those values in the training archive.
    • Won't reload neural nets and will instead initialize new ones even if max/min boundaries are the same.
    • For Gaussian process it is ok to load hyperparameters and histories even if boundaries changed since they are recorded in real unscaled units, so they are loaded from the archive.
  • Configuration options, e.g. cost_has_noise, use the user-supplied keyword argument values and usual defaults, ignoring the values in the archive.
  • The visualization classes will overwrite attribute values with their values from the archive where necessary during their __init__().

zakv added 5 commits December 19, 2020 10:33
…anProcessLearner can use each other's archives as training archives.
…do not include any data from the training archive if one was provided at the begining of the optimization.
… with respect to data in the training archive if one was provided at the start of the optimization.
…ed as training data archives for the machine-learning-based learners.
zakv added 2 commits December 20, 2020 10:21
…ler to the learner for some controller types, which meant that the learner archive would be missing the results from the last run.
@zakv
Copy link
Collaborator Author

zakv commented Dec 22, 2020

@charmasaur There are a lot of changes in this PR, but a lot of it is just reorganization. I did a test optimization with each learner, checked that GaussianProcessLearner and NeuralNetLearner could use any archive as a training archive, and checked that visualizations still worked. Everything seems to be running ok. Are you interested in taking a look or should I just merge it?

@charmasaur
Copy link
Collaborator

charmasaur commented Dec 22, 2020 via email

@zakv zakv merged commit ca15918 into michaelhush:master Dec 22, 2020
@zakv zakv deleted the training-archive-loading branch December 22, 2020 08:53
zakv added a commit to zakv/M-LOOP that referenced this pull request Dec 25, 2020
…alizer and NeuralNetVisualizer use the default value for param_names instead of loading it from the archive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem importing previous training data when using gaussian process
2 participants