Skip to content

Commit bd510fb

Browse files
authored
Merge pull request #245 from SURGroup/Development
Development
2 parents f8d0b1d + 03e338d commit bd510fb

File tree

20 files changed

+127
-104
lines changed

20 files changed

+127
-104
lines changed

README.rst

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,31 @@
1313
:alt: bear-ified
1414

1515

16-
*******************************************
16+
**********************************************
1717
Uncertainty Quantification with python (UQpy)
18-
*******************************************
18+
**********************************************
1919

2020
|logo|
2121

22-
====
23-
24-
+-----------------------+------------------------------------------------------------------+
25-
| **Product Owner:** | Michael D. Shields |
26-
+-----------------------+------------------------------------------------------------------+
27-
| **Lead Developers:** | Dimitris Giovanis, Audrey Olivier, Dimitris Tsapetis |
28-
+-----------------------+------------------------------------------------------------------+
29-
| **Development Team:** | Aakash Bangalore Satish, Mohit Singh Chauhan, Lohit Vandanapu, |
30-
+ + +
31-
| | Ketson RM dos Santos, Katiana Kontolati, Dimitris Loukrezis, |
32-
+ + +
33-
| | Promit Chakroborty, Lukáš Novák, Andrew Solanto, Connor Krill |
34-
+-----------------------+------------------------------------------------------------------+
35-
| **Contributors:** | Michael Gardner, Prateek Bhustali, Julius Schultz, Ulrich Römer |
36-
+-----------------------+------------------------------------------------------------------+
22+
================================================================================================
23+
24+
.. list-table::
25+
:widths: 100, 200
26+
:header-rows: 0
27+
28+
* - **Product Owner:**
29+
- Michael D. Shields
30+
31+
* - **Lead Developers:**
32+
- Dimitris Giovanis, Audrey Olivier, Dimitris Tsapetis
33+
34+
* - **Development Team:**
35+
- Aakash Bangalore Satish, Mohit Singh Chauhan, Lohit Vandanapu, Ketson RM dos Santos, Katiana Kontolati, Dimitris Loukrezis, Promit Chakroborty, Lukáš Novák, Andrew Solanto, Connor Krill
36+
37+
* - **Contributors:**
38+
- Michael Gardner, Prateek Bhustali, Julius Schultz, Ulrich Römer
39+
40+
3741

3842
Contact
3943
===========
@@ -54,7 +58,7 @@ Website:
5458
https://uqpyproject.readthedocs.io
5559

5660
Dependencies
57-
===========
61+
===============
5862

5963
* ::
6064
@@ -65,7 +69,7 @@ License
6569
===========
6670
UQpy is distributed under the MIT license
6771

68-
Copyright (C) <2018> <Michael D. Shields>
72+
Copyright (C) <2024> <Michael D. Shields>
6973

7074
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7175

@@ -75,7 +79,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
7579

7680

7781
Installation
78-
===========
82+
===============
7983

8084
From PyPI
8185

@@ -109,13 +113,13 @@ Olivier, A., Giovanis, D.G., Aakash, B.S., Chauhan, M., Vandanapu, L., and Shiel
109113

110114

111115
Help and Support
112-
===========
116+
==================
113117

114118
For assistance with the UQpy software package, please raise an issue on the Github Issues page. Please use the appropriate labels to indicate which module you are specifically inquiring about.
115119

116120
.. |logo| image:: logo.jpg
117-
:scale: 25 %
118-
:target: https://gihub.com/SURGroup/UQpy
121+
:height: 250px
122+
:target: https://github.com/SURGroup/UQpy
119123

120124

121125

requirements.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
numpy == 1.22.0
2-
scipy == 1.8.0
3-
matplotlib == 3.5.2
4-
scikit-learn == 1.0.2
5-
fire == 0.4.0
6-
pytest == 6.1.2
7-
coverage == 5.3
8-
pytest-cov == 2.10.1
9-
pylint == 2.6.0
10-
wheel == 0.38.1
11-
pytest-azurepipelines == 0.8.0
12-
twine == 3.4.1
1+
numpy == 1.26.4
2+
scipy == 1.6.0
3+
matplotlib == 3.8.4
4+
scikit-learn == 1.4.2
5+
fire == 0.6.0
6+
pytest == 8.2.0
7+
coverage == 7.5.0
8+
pytest-cov == 5.0.0
9+
pylint == 3.1.0
10+
wheel == 0.43.0
11+
pytest-azurepipelines == 1.0.5
12+
twine == 5.0.0
1313
pathlib~=1.0.1
14-
beartype ==0.9.1
14+
beartype == 0.18.5
1515
setuptools~=65.5.1

setup.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,44 @@
44
del sys.argv[1]
55
from setuptools import setup, find_packages
66

7+
from pathlib import Path
8+
this_directory = Path(__file__).parent
9+
long_description = (this_directory / "README.rst").read_text()
10+
711
setup(
812
name='UQpy',
913
version=version,
1014
url='https://github.com/SURGroup/UQpy',
1115
description="UQpy is a general purpose toolbox for Uncertainty Quantification",
16+
long_description=long_description,
1217
author="Michael D. Shields, Dimitris G. Giovanis, Audrey Olivier, Aakash Bangalore-Satish, Mohit Chauhan, "
1318
"Lohit Vandanapu, Ketson R.M. dos Santos",
14-
author_email="[email protected]",
1519
license='MIT',
1620
platforms=["OSX", "Windows", "Linux"],
1721
packages=find_packages("src"),
1822
package_dir={"": "src"},
1923
package_data={"": ["*.pdf"]},
24+
python_requires='>3.9.0',
2025
install_requires=[
21-
"numpy", "scipy", "matplotlib", "scikit-learn", 'fire',
22-
"beartype==0.9.1",
26+
"numpy", "scipy>=1.6.0", "matplotlib", "scikit-learn", 'fire',
27+
"beartype==0.18.5",
2328
],
29+
extras_require={
30+
'dev': [
31+
'pytest == 8.2.0',
32+
'pytest-cov == 5.0.0',
33+
'pylint == 3.1.0',
34+
'pytest-azurepipelines == 1.0.5',
35+
'pytest-cov == 5.0.0',
36+
'wheel == 0.43.0',
37+
'twine == 5.0.0',
38+
'sphinx_autodoc_typehints == 1.23.0',
39+
'sphinx_rtd_theme == 1.2.0',
40+
'sphinx_gallery == 0.13.0',
41+
'sphinxcontrib_bibtex == 2.5.0',
42+
'Sphinx==6.1.3',
43+
]
44+
},
2445
classifiers=[
2546
'Programming Language :: Python :: 3',
2647
'Intended Audience :: Science/Research',

src/UQpy/dimension_reduction/diffusion_maps/DiffusionMaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _fit(self):
133133
transition_matrix = d_star_inv_d.dot(l_star)
134134

135135
if self.is_sparse:
136-
is_symmetric = sp.sparse.linalg.norm(transition_matrix - transition_matrix.T, sp.inf) < 1e-08
136+
is_symmetric = sp.sparse.linalg.norm(transition_matrix - transition_matrix.T, np.inf) < 1e-08
137137
else:
138138
is_symmetric = np.allclose(transition_matrix, transition_matrix.T, rtol=1e-5, atol=1e-08)
139139

src/UQpy/sampling/mcmc/tempering_mcmc/ParallelTemperingMCMC.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from scipy.special import logsumexp
2-
from scipy.integrate import trapz
2+
from scipy.integrate import trapezoid
33

44
from UQpy.sampling.mcmc import MetropolisHastings
55
from UQpy.sampling.mcmc.baseclass.MCMC import *
@@ -216,7 +216,7 @@ def evaluate_normalization_constant(self, compute_potential, log_Z0: float = Non
216216
# use quadrature to integrate between 0 and 1
217217
temper_param_list_for_integration = np.copy(np.array(self.tempering_parameters))
218218
log_pdf_averages = np.array(log_pdf_averages)
219-
int_value = trapz(x=temper_param_list_for_integration, y=log_pdf_averages)
219+
int_value = trapezoid(x=temper_param_list_for_integration, y=log_pdf_averages)
220220
if log_Z0 is None:
221221
samples_p0 = self.distribution_reference.rvs(nsamples=nsamples_from_p0)
222222
log_Z0 = np.log(1. / nsamples_from_p0) + logsumexp(

src/UQpy/sampling/stratified_sampling/strata/VoronoiStrata.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,18 @@ def sample_strata(self, nsamples_per_stratum, random_state):
175175

176176
# Compute volume of each delaunay
177177
volume = list()
178-
for i in range(len(delaunay_obj.vertices)):
179-
vert = delaunay_obj.vertices[i]
178+
for i in range(len(delaunay_obj.simplices)):
179+
vert = delaunay_obj.simplices[i]
180180
ch = ConvexHull(seed_and_vertices[vert])
181181
volume.append(ch.volume)
182182

183183
temp_prob = np.array(volume) / sum(volume)
184-
a = list(range(len(delaunay_obj.vertices)))
184+
a = list(range(len(delaunay_obj.simplices)))
185185
for k in range(int(nsamples_per_stratum[j])):
186186
simplex = random_state.choice(a, p=temp_prob)
187187

188188
new_samples = SimplexSampling(
189-
nodes=seed_and_vertices[delaunay_obj.vertices[simplex]],
189+
nodes=seed_and_vertices[delaunay_obj.simplices[simplex]],
190190
nsamples=1,
191191
random_state=self.random_state,
192192
).samples
@@ -205,15 +205,15 @@ def compute_centroids(self):
205205

206206
for j in range(self.mesh.nsimplex):
207207
try:
208-
ConvexHull(self.points[self.mesh.vertices[j]])
208+
ConvexHull(self.points[self.mesh.simplices[j]])
209209
self.mesh.centroids[j, :], self.mesh.volumes[j] = \
210-
DelaunayStrata.compute_delaunay_centroid_volume(self.points[self.mesh.vertices[j]])
210+
DelaunayStrata.compute_delaunay_centroid_volume(self.points[self.mesh.simplices[j]])
211211
except qhull.QhullError:
212212
self.mesh.centroids[j, :], self.mesh.volumes[j] = (np.mean(self.points[self.mesh.vertices[j]]), 0,)
213213

214214
def initialize(self, samples_number, training_points):
215215
self.add_boundary_points_and_construct_delaunay(samples_number, training_points)
216-
self.mesh.old_vertices = self.mesh.vertices.copy()
216+
self.mesh.old_vertices = self.mesh.simplices.copy()
217217

218218
def add_boundary_points_and_construct_delaunay(
219219
self, samples_number, training_points
@@ -377,7 +377,7 @@ def _update_strata(self, new_point, samples_u01):
377377
p_ = new_point.shape[0]
378378
# Update the matrices to have recognize the new point
379379
self.points_to_samplesU01 = np.hstack([self.points_to_samplesU01, np.arange(i_, i_ + p_)])
380-
self.mesh.old_vertices = self.mesh.vertices
380+
self.mesh.old_vertices = self.mesh.simplices
381381

382382
# Update the Delaunay triangulation mesh to include the new point.
383383
self.mesh.add_points(new_point)

src/UQpy/surrogates/gaussian_process/GaussianProcessRegression.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ def predict(self, points, return_std: bool = False, hyperparameters: list = None
297297
else:
298298
mu1 = np.einsum("ij,jk->ik", fx, self.beta)
299299

300-
self.kernel.kernel_parameter = kernelparameters[:-1]
301-
sigma = kernelparameters[-1]
300+
if kernelparameters is not None:
301+
self.kernel.kernel_parameter = kernelparameters[:-1]
302+
sigma = kernelparameters[-1]
302303

303304
k = sigma**2*self.kernel.calculate_kernel_matrix(x=x_, s=s_)
304305
y = mu1 + k @ alpha_

src/UQpy/surrogates/polynomial_chaos/regressions/LeastAngleRegression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run(self, x: np.ndarray, y: np.ndarray, design_matrix: np.ndarray):
4545
n_samples, inputs_number = x.shape
4646

4747
reg = regresion.Lars(fit_intercept=self.fit_intercept, verbose=self.verbose,
48-
n_nonzero_coefs=self.n_nonzero_coefs, normalize=self.normalize)
48+
n_nonzero_coefs=self.n_nonzero_coefs)
4949
reg.fit(design_matrix, y)
5050

5151
# LarsBeta = reg.coef_path_

src/UQpy/utilities/Utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def correlation_distortion(dist_object, rho):
316316
:rtype: float
317317
"""
318318

319-
if rho == 1.0:
319+
if np.isclose(rho, 1.0):
320320
rho = 0.999
321321
n = 512
322322
zmax = 8

src/UQpy/utilities/kernels/euclidean_kernels/Matern.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def __init__(self, kernel_parameter: Union[int, float] = 1, nu=1.5):
2121
def calculate_kernel_matrix(self, x, s):
2222
l = self.kernel_parameter
2323
stack = cdist(x / l, s / l, metric='euclidean')
24-
if self.nu == 0.5:
24+
if np.isclose(self.nu, 0.5):
2525
self.kernel_matrix = np.exp(-np.abs(stack))
26-
elif self.nu == 1.5:
26+
elif np.isclose(self.nu,1.5):
2727
self.kernel_matrix = (1 + np.sqrt(3) * stack) * np.exp(-np.sqrt(3) * stack)
28-
elif self.nu == 2.5:
28+
elif np.isclose(self.nu, 2.5):
2929
self.kernel_matrix = (1 + np.sqrt(5) * stack + 5 * (stack ** 2) / 3) * np.exp(-np.sqrt(5) * stack)
3030
elif self.nu == np.inf:
3131
self.kernel_matrix = np.exp(-(stack ** 2) / 2)

0 commit comments

Comments
 (0)