Skip to content

Commit

Permalink
Merge pull request #193 from SURGroup/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
dimtsap authored Jan 18, 2023
2 parents 2f16b1a + 55fed0b commit bfbb5eb
Show file tree
Hide file tree
Showing 33 changed files with 161 additions and 1,058 deletions.
2 changes: 1 addition & 1 deletion docs/code/surrogates/gpr/plot_gpr_custom2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
y_act = np.array(r2model.qoi_list).reshape(x1g.shape[0], x1g.shape[1])

fig1 = plt.figure()
ax = fig1.gca(projection='3d')
ax = fig1.add_subplot(projection='3d')
surf = ax.plot_surface(x1g, x2g, y_act, cmap=cm.coolwarm, linewidth=0, antialiased=False)
ax.set_zlim(-1, 15)
ax.zaxis.set_major_locator(LinearLocator(10))
Expand Down
6 changes: 3 additions & 3 deletions docs/code/surrogates/pce/plot_pce_camel.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def function(x, y):
f = function(X1_, X2_)

fig = plt.figure(figsize=(10, 6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
surf = ax.plot_surface(X1_, X2_, f, rstride=1, cstride=1, cmap='gnuplot2', linewidth=0, antialiased=False)
ax.set_title('True function')
ax.set_xlabel('$x_1$', fontsize=15)
Expand All @@ -95,7 +95,7 @@ def function(x, y):
# %%

fig = plt.figure(figsize=(10, 6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
ax.scatter(x[:, 0], x[:, 1], y, s=20, c='r')

ax.set_title('Training data')
Expand Down Expand Up @@ -168,7 +168,7 @@ def function(x, y):
# %%

fig = plt.figure(figsize=(10,6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
ax.scatter(x_test[:,0], x_test[:,1], y_test, s=1)

ax.set_title('PCE predictor')
Expand Down
6 changes: 3 additions & 3 deletions docs/code/surrogates/pce/plot_pce_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def function(x,y):
f = function(X1_, X2_)

fig = plt.figure(figsize=(10,6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
surf = ax.plot_surface(X1_, X2_, f, rstride=1, cstride=1, cmap='gnuplot2', linewidth=0, antialiased=False)
ax.set_title('True function')
ax.set_xlabel('$x_1$', fontsize=15)
Expand All @@ -90,7 +90,7 @@ def function(x,y):
# %%

fig = plt.figure(figsize=(10,6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
ax.scatter(x[:,0], x[:,1], y, s=20, c='r')

ax.set_title('Training data')
Expand Down Expand Up @@ -156,7 +156,7 @@ def function(x,y):
# %%

fig = plt.figure(figsize=(10,6))
ax = fig.gca(projection='3d')
ax = fig.add_subplot(projection='3d')
ax.scatter(x_test[:,0], x_test[:,1], y_test, s=1)

ax.set_title('PCE predictor')
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pytest == 6.1.2
coverage == 5.3
pytest-cov == 2.10.1
pylint == 2.6.0
wheel == 0.36.2
wheel == 0.38.1
pytest-azurepipelines == 0.8.0
twine == 3.4.1
pathlib~=1.0.1
beartype ==0.9.1
setuptools~=58.0.4
setuptools~=65.5.1
2 changes: 1 addition & 1 deletion src/UQpy/reliability/taylor_series/FORM.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def run(self, seed_x: Union[list, np.ndarray] = None,
else:
k = k + 1

self.logger.error("Error: %s", error_record[-1])
self.logger.info("Error: %s", error_record[-1])

if converged is True or k > self.n_iterations:
break
Expand Down
2 changes: 1 addition & 1 deletion src/UQpy/sampling/SimplexSampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(
self,
nodes: Union[list, Numpy2DFloatArray] = None,
nsamples: PositiveInteger = None,
random_state: RandomStateType = None,
random_state: Union[RandomStateType, np.random.Generator] = None,
):
"""
Generate uniform random samples inside an n-dimensional simplex.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class LearningFunction(ABC):
def __init(self, ordered_parameters=None, **kwargs):
self.parameters = kwargs
self.ordered_parameters = (ordered_parameters if not None else tuple(kwargs.keys()))
self.ordered_parameters = (ordered_parameters if ordered_parameters is not None else tuple(kwargs.keys()))
if len(self.ordered_parameters) != len(self.parameters):
raise ValueError("Inconsistent dimensions between order_params tuple and params dictionary.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.random_state = random_state
if isinstance(self.random_state, int):
self.random_state = np.random.RandomState(self.random_state)
self.random_state = np.random.default_rng(self.random_state)
elif not isinstance(self.random_state, (type(None), np.random.RandomState)):
raise TypeError('UQpy: random_state must be None, an int or an np.random.Generator object.')
if self.random_state is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def finalize(self, samples, samples_per_iteration):
def identify_bins(strata_metrics, points_to_add, random_state):
bins2break = np.array([])
points_left = points_to_add
while (np.where(strata_metrics == strata_metrics.max())[0].shape[0] < points_left):
while np.where(strata_metrics == strata_metrics.max())[0].shape[0] < points_left:
bin = np.where(strata_metrics == strata_metrics.max())[0]
bins2break = np.hstack([bins2break, bin])
strata_metrics[bin] = 0
Expand Down
1 change: 0 additions & 1 deletion src/UQpy/surrogates/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from UQpy.surrogates.polynomial_chaos import *
from UQpy.surrogates.stochastic_reduced_order_models import *
from UQpy.surrogates.kriging import *
from UQpy.surrogates.gaussian_process import *
from UQpy.surrogates.baseclass import *

Expand Down
Loading

0 comments on commit bfbb5eb

Please sign in to comment.