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

Add plotting module #131

Closed
wants to merge 70 commits into from
Closed

Add plotting module #131

wants to merge 70 commits into from

Conversation

ljvmiranda921
Copy link
Owner

Reference: #130

@ljvmiranda921 ljvmiranda921 added the enhancement Feature requests label Jun 12, 2018
@ljvmiranda921 ljvmiranda921 self-assigned this Jun 12, 2018
@ljvmiranda921
Copy link
Owner Author

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.

ljvmiranda921 added 5 commits June 13, 2018 22:00
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]>
ljvmiranda921 added 4 commits June 13, 2018 22:30
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]>
ljvmiranda921 added 15 commits June 14, 2018 13:08
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]>
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]>
ljvmiranda921 and others added 27 commits June 14, 2018 15:28
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]>
@ljvmiranda921 ljvmiranda921 deleted the add-plotters-module branch June 14, 2018 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants