Skip to content

Commit 9829142

Browse files
committed
add examples for visualization helpers
1 parent ac3b978 commit 9829142

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

examples/plot_contour.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from surfaces.test_functions.algebraic.test_functions_2d import BealeFunction
2+
from surfaces.visualize import plot_contour
3+
4+
func = BealeFunction()
5+
fig = plot_contour(func)
6+
fig.show()

examples/plot_convergence.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from surfaces.test_functions.algebraic.test_functions_nd import RastriginFunction
2+
from surfaces.visualize import plot_convergence
3+
4+
func = RastriginFunction(n_dim=10)
5+
history = [120, 95, 80, 65, 50, 42, 35, 28, 22, 18, 15, 12, 10, 8, 6, 5, 4, 3]
6+
fig = plot_convergence(func, history)
7+
fig.show()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from surfaces.test_functions.algebraic.test_functions_nd import GriewankFunction
2+
from surfaces.visualize import plot_fitness_distribution
3+
4+
func = GriewankFunction(n_dim=10)
5+
fig = plot_fitness_distribution(func, n_samples=5000)
6+
fig.show()

examples/plot_multi_slice.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from surfaces.test_functions.algebraic.test_functions_nd import SphereFunction
2+
from surfaces.visualize import plot_multi_slice
3+
4+
func = SphereFunction(n_dim=5)
5+
fig = plot_multi_slice(func)
6+
fig.show()

examples/plot_surface.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from surfaces.test_functions.algebraic.test_functions_2d import AckleyFunction
2+
from surfaces.visualize import plot_surface
3+
4+
func = AckleyFunction()
5+
fig = plot_surface(func)
6+
fig.show()

0 commit comments

Comments
 (0)