-
Notifications
You must be signed in to change notification settings - Fork 23
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
CMA-ES implementation and Force example #235
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added all base method for the CMA-ES component of MTUQ. In the process of streamlining the parallel_cmaes.py implementation.
This will be the default file for development. Non-mpi version will be tested but might not be fully developed.
Corrected a few anomalies in the code. The path and cov update now correspond to purecma python package.
Based on GridSearch.FullMomentTensor.py, should provide a nice overview of the basic MT inversion with CMA-ES. Still work in progress.
Added a new function to automatically create the list of parameters for force inversion.
Work in progress Force CMA-ES application. Currently works with the "greens" mode in CMAES.Force.py
Fixed import error and cleaned up debug plot.
Tested the database mode on a depth-search.
This reverts commit 815d735.
This reverts commit aa596b3.
Overhauled the script description and populated with comments and recommendations on uses.
Local paths referring to my machine have been replaced with "generic" path to be changed by users.
Reset boundary handling method back to rand-based, instead of re-initialize.
Slight modification to allow for matplotlib backend plot for _plot_lune_matplotlib and the use of CMA-ES log as input for the main mtuq plot_misfit_lune() function
Allows plotting CMA-ES result (would fail otherwise when encountering a single sample in a bin)
Added a plot_type argument to allow more flexibility when plotting with the Matplotlib backend (allowing pcolormesh, scatter plots and contour plots). Correct docstrings for the _plot_lune_matplotlib() method.
Added "plot_type" argument to force plots functions
Removed unnecessary argument that can go in **kwargs, to follow original syntax.
Implemented polarity misfit for point-force sources. A test function has also been added in order to verify that the USE convention is respected.
Removed unnecessary normalization.
Changed the default behavior for the v and w variable to "reinitialize" as it might helps with sampling close to the boundaries (even if making the convergence a bit slower).
Updated CMA-ES examples with new input syntax (for weighted misfit)
Fixed tri-contour bug encountered with NaN values in force plots.
Fixed colormesh on the sphere by splitting the plot in two to avoid projection artifacts.
Corrected the mis-rotation of DC data
Replaced dataset with Ezgi's example.
Changed default behavior for h to reinitialize for better exploration of both up and down hemispheres.
Defined default example for the Force CMA-ES, based on the Barry Arm glacier Landslide
Modified default weights for CMA.Solve in the database mode.
Changed naming convention for figures, and added event_id field in example CMA object initialization.
Fixed final naming convention.
Added data from the Barry Arm landslide for force inversion examples.
Allowing different naming conventions for long-period data (MXZ, MXR, MXT on top of BXZ, BXR, BXT)
Added the force sphere plot during the plotting phase of the Solve method. Also fixed the mean misfit location as the green circle in the plot (in-lieu of the minimum of the misfit map).
Added scatter plot functionality to force mode. The behavior will now be to return a different plot for each mode (Lune or Force sphere) based on CMA-ES mode (mt, mt_dc, mt_dev or force).
Added rank.0 plotting function (would otherwise cause problems on parallel jobs).
Final version of the CMA-ES force example.
Created the Force Example for MTUQ based on the Barry Arm glacier landslide.
Restored default .gitignore
Updated comment before final commit and PR.
Tests failed because of mpi4py, will try to change and resubmit PR. Closing this one for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is a brief list of the main contributions of this pull request:
I have made a lot of tests and integrated feedback from @SeismoFelix and @ammcpherson who helped test an earlier version of the CMA-ES implementation.
The CMA-ES solver has been tested with several data groups and polarity misfits. It includes the option to balance the contribution of each waveform group that is given as input (and will otherwise default to normalize each misfit contribution by the data norm).
It is initialized with the following:
which uses most of the default MTUQ objects. The solve method will perform 60 CMA-ES iterations, with a population of 48 samples/mutants to evolve, and plot waveform misfit and misfit map every 10 steps along the way. The misfit map is updated by the new one rather than being kept on disk.
If you want to be more specific with your result processing, it is possible to return the whole CMA-ES history of samples with the following:
which returns a similar object to the random grid search solutions (
mtuq.grid_search.MTUQDataFrame
) and is thus compatible with other base functions in the code.