-
Notifications
You must be signed in to change notification settings - Fork 335
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
Add plotting module #131
Closed
Closed
Add plotting module #131
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
Perhaps we can remove the dependency on the getters? it violates Python's rule of having only one way of doing things. We can actually access the cost histories (and other things) from optimizer instance themselves. |
6ab7682
to
afb3d02
Compare
This commit makes the if-else statements in generators more concise. To be honest, I didn't know what came into my mind as to why I nested those if statements. It turns out that using the "and" operator is much, much better. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we add a DeprecationWarning for the PlotEnvironment module. Although useful, I realized that it might be a hassle when the environment still optimizes the optimizer if we just want to plot it. What if a swarm iteration takes a long time? Will plotting take the same amount of time? We want to decouple the optimization part from the visualization. It is better to just have the user supply the position and cost histories and we just have the module do what it knows. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we decided to remove the @Property in storing the dependency. I found this very redundant and violates Python's rule of having only one way of doing things. Instead, we just access the histories from the class/instance attributes Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we updated the tests on the optimizers to reflect the changes on using @Property. It's much better now because our tests are parameterized than having multiple asserts. Signed-off-by: Lester James V. Miranda <[email protected]>
This coincides with the decision to deprecate the PlotEnvironment. The whole environments module is now unsupported, and users will now be required to use the plotters module instead. Signed-off-by: Lester James V. Miranda <[email protected]>
bd1b24e
to
9f1a3b0
Compare
Reference: #130 This commit adds a plotters.py module to replace the environments module. We hope that we can actually decouple the optimization and visualization part, without having the environment to do another rollout of your PSO. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 The problem before is that we tend to have many parameters in our plotting functions. The formatters module changes that. We have three types of formatters: Designer, Animator, and Mesher. There are defaults present, but the user can change and pass them to the ploting functions whenever needed. Signed-off-by: Lester James V. Miranda <[email protected]>
Sometimes your swarm can generate a pure 0 or pure 1 vector, we should account that. Signed-off-by: Lester James V. Miranda <[email protected]>
f4db1dc
to
2806abe
Compare
Reference: #130 This commit adds a plotters.py module to replace the environments module. We hope that we can actually decouple the optimization and visualization part, without having the environment to do another rollout of your PSO. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 The problem before is that we tend to have many parameters in our plotting functions. The formatters module changes that. We have three types of formatters: Designer, Animator, and Mesher. There are defaults present, but the user can change and pass them to the ploting functions whenever needed. Signed-off-by: Lester James V. Miranda <[email protected]>
Sometimes your swarm can generate a pure 0 or pure 1 vector, we should account that. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the plotters module into ReadTheDocs index and adds a deprecated information on plot_environment.py Signed-off-by: Lester James V. Miranda <[email protected]> [WIP-env] Add deprecated to env docs [WIP] Add plotters DOCS
This commit updates the docstrings in formatters.py and adds a legend attribute in plotters.py Signed-off-by: Lester James V. Miranda <[email protected]>
Add plotters to docs
This commit adds the Topology module's __init__ file. The concept behind this module is that if we can add topologies in a modular fashion, we can easily explore different PSO behaviour. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the base Topology class that must be inherited by any topology implementation. It raises a NotImplementedError whenever the compute_gbest(), compute_position(), and compute_velocity() are not called. I decided to put the compute_position() and compute_velocity() methods here because there may be cases where these operations are controlled by the Topology itself. In case, standard implementations are required, pyswarms.backend.operators should suffice. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the Star class topology for the GlobalBestPSO implementation. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we move the global best computation to the Topology classes themselves, but keep the compute_pbest(), compute_position() and compute_velocity() so that people can reuse it. The position and velocity computations are standard implementations, so this is just imported by the Ring and Star topology classes in their own methods Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the Ring class topology for the LocalBestPSO implementation. In the next iteration, we should start considering having a strict number of neighbors (static and dynamic). But let's solve the BinaryPSO first before going there. Signed-off-by: Lester James V. Miranda <[email protected]>
Add some explanation about the PySwarms API and on how to use the backend module. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit updates the default parameters in create_swarm (options, by default, is now an empty dict), and in the update_velocity of the ring and star topologies (clamp, by default, is now None) Signed-off-by: Lester James V. Miranda <[email protected]>
This commit should update all Jupyter notebook examples to the dev version. Hopefully everything is okay after this. This also adds a new notebook for demonstrating the custom optimization loop. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds a branch matrix in both README and index.rst. This gives a better overview of the doc and build status of both master and development branches. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit makes the if-else statements in generators more concise. To be honest, I didn't know what came into my mind as to why I nested those if statements. It turns out that using the "and" operator is much, much better. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we add a DeprecationWarning for the PlotEnvironment module. Although useful, I realized that it might be a hassle when the environment still optimizes the optimizer if we just want to plot it. What if a swarm iteration takes a long time? Will plotting take the same amount of time? We want to decouple the optimization part from the visualization. It is better to just have the user supply the position and cost histories and we just have the module do what it knows. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we decided to remove the @Property in storing the dependency. I found this very redundant and violates Python's rule of having only one way of doing things. Instead, we just access the histories from the class/instance attributes Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we updated the tests on the optimizers to reflect the changes on using @Property. It's much better now because our tests are parameterized than having multiple asserts. Signed-off-by: Lester James V. Miranda <[email protected]>
This coincides with the decision to deprecate the PlotEnvironment. The whole environments module is now unsupported, and users will now be required to use the plotters module instead. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 This commit adds a plotters.py module to replace the environments module. We hope that we can actually decouple the optimization and visualization part, without having the environment to do another rollout of your PSO. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 The problem before is that we tend to have many parameters in our plotting functions. The formatters module changes that. We have three types of formatters: Designer, Animator, and Mesher. There are defaults present, but the user can change and pass them to the ploting functions whenever needed. Signed-off-by: Lester James V. Miranda <[email protected]>
Sometimes your swarm can generate a pure 0 or pure 1 vector, we should account that. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the plotters module into ReadTheDocs index and adds a deprecated information on plot_environment.py Signed-off-by: Lester James V. Miranda <[email protected]> [WIP-env] Add deprecated to env docs [WIP] Add plotters DOCS
This commit updates the docstrings in formatters.py and adds a legend attribute in plotters.py Signed-off-by: Lester James V. Miranda <[email protected]>
Merged
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.
Reference: #130