Skip to content

Commit 2ffcc3c

Browse files
v0.6.28
1 parent 34ed9be commit 2ffcc3c

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.6.27"
10+
version = "0.6.28"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/spot/spot.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,41 @@ def __init__(
320320
if self.optimizer is None:
321321
self.optimizer = optimize.differential_evolution
322322

323+
def get_vars(self):
324+
"""
325+
Get the variables of the class.
326+
327+
Returns:
328+
(pandas.DataFrame): variables of the class.
329+
330+
Examples:
331+
>>> import numpy as np
332+
from math import inf
333+
from spotPython.fun.objectivefunctions import analytical
334+
from spotPython.spot import spot
335+
# number of initial points:
336+
ni = 7
337+
# number of points
338+
n = 10
339+
340+
fun = analytical().fun_sphere
341+
lower = np.array([-1])
342+
upper = np.array([1])
343+
design_control={"init_size": ni}
344+
345+
spot_1 = spot.Spot(fun=fun,
346+
lower = lower,
347+
upper= upper,
348+
fun_evals = n,
349+
show_progress=True,
350+
design_control=design_control,)
351+
spot_1.run()
352+
spot_1.get_vars()
353+
354+
"""
355+
df = pd.DataFrame.from_records([vars(self)])
356+
return df.T
357+
323358
def to_red_dim(self):
324359
self.all_lower = self.lower
325360
self.all_upper = self.upper
@@ -937,12 +972,12 @@ def plot_importance(self, threshold=0.1, filename=None, dpi=300, show=True) -> N
937972
if show:
938973
plt.show()
939974

940-
def parallel_plot(self, show=True) -> go.Figure:
975+
def parallel_plot(self, show=False) -> go.Figure:
941976
"""
942977
Parallel plot.
943978
944979
Args:
945-
show (bool): show the plot
980+
show (bool): show the plot. Default is `False`.
946981
947982
Returns:
948983
fig (plotly.graph_objects.Figure): figure object

0 commit comments

Comments
 (0)