The jmetal.lab.visualization
submodule contains several classes useful for plotting solutions. jMetalPy includes three types of visualization charts: static, interactive and streaming.
It is possible to visualize the final front approximation by using the Plot
class:
from jmetal.lab.visualization import Plot
plot_front = Plot(title='Pareto front approximation', axis_labels=['x', 'y'])
plot_front.plot(front, label='NSGAII-ZDT1')
Note
Static charts can be shown in the screen or stored in a file by setting the filename.
For problems with two and three objectives, the figure produced is a scatter plot; for problems with more than three objectives, a parallel coordinates plot is used. Note that any arbitrary number of fronts can be plotted for comparison purposes:
plot_front = Plot(title='Pareto front approximation', axis_labels=['x', 'y'])
plot_front.plot([front1, front2], label=['zdt1', 'zdt2'], filename='output', format='eps')
Bases: object
Get points for each solution of the front.
solutions – List of solutions.
Pandas dataframe with one column for each objective and one row for each solution.
Plot any arbitrary number of fronts in parallel coordinates.
fronts – List of fronts (containing solutions).
filename – Output filename.
Plot any arbitrary number of fronts in 2D, 3D or p-coords.
front – Pareto front or a list of them.
label – Pareto front title or a list of them.
normalize – If True, normalize data (for p-coords).
filename – Output filename.
format – Output file format.
This kind of plots are interactive in such a way that every solution can be manipulated (e.g., actions such as zoom, selecting part of the graph, or clicking in a point to see its objective values are allowed).
plot_front = InteractivePlot(title='Pareto front approximation')
plot_front.plot(front, label='NSGAII-ZDT1', filename='NSGAII-ZDT1-interactive')
Bases: Plot
Export as a div for embedding the graph in an HTML file.
filename – Output file name (if desired, default to None).
include_plotlyjs – If True, include plot.ly JS script (default to False).
Script as string.
Export the graph to an interactive HTML (solutions can be selected to show some metadata).
filename – Output file name.
Script as string.
Plot a front of solutions (2D, 3D or parallel coordinates).
front – List of solutions.
label – Front name.
normalize – Normalize the input front between 0 and 1 (for problems with more than 3 objectives).
filename – Output filename.
The visualizer observer displays the front in real-time (note it only works for problems with two and three objectives) during the execution of multi-objective algorithms; this can be useful to observe the evolution of the Pareto front approximation:
from jmetal.util.observer import VisualizerObserver
algorithm.observable.register(observer=VisualizerObserver(reference_front=problem.reference_front))
Plots the sample from posterior distribution of a Bayesian statistical test. Parameters: ———– data: An (n x 3) array or DataFrame contaning the probabilities. alg_names: array of strings. Default np.array([‘Alg1’, ‘Alg2’])
Names of the algorithms under evaluation
Figure