From d78b28ba8da7405d111d2715a459c694aa023697 Mon Sep 17 00:00:00 2001
From: Prateek Bhustali
Date: Mon, 23 May 2022 14:55:26 +0200
Subject: [PATCH] Changed variable name: CI -> confidence interval
---
src/UQpy/sensitivity/Chatterjee.py | 10 ++++---
src/UQpy/sensitivity/CramervonMises.py | 10 ++++---
src/UQpy/sensitivity/GeneralisedSobol.py | 16 ++++++----
src/UQpy/sensitivity/Sobol.py | 30 +++++++++++--------
.../sensitivity/test_cramer_von_mises.py | 2 +-
.../sensitivity/test_generalised_sobol.py | 6 ++--
tests/unit_tests/sensitivity/test_sobol.py | 10 ++++---
7 files changed, 51 insertions(+), 33 deletions(-)
diff --git a/src/UQpy/sensitivity/Chatterjee.py b/src/UQpy/sensitivity/Chatterjee.py
index 1eb13ff1..a171e624 100644
--- a/src/UQpy/sensitivity/Chatterjee.py
+++ b/src/UQpy/sensitivity/Chatterjee.py
@@ -81,7 +81,7 @@ def __init__(self, runmodel_object, dist_object, random_state=None, **kwargs):
self.sobol_i = None
"Sobol indices computed using the rank statistics, :class:`numpy.ndarray` of shape :code:`(num_vars, 1)`"
- self.CI_chatterjee_i = None
+ self.confidence_interval_chatterjee_i = None
"Confidence intervals for the Chatterjee sensitivity indices, :class:`numpy.ndarray` of shape :code:`(num_vars, 2)`"
self.num_vars = None
@@ -115,7 +115,7 @@ def run(
:return: A :class:`dict` with the following keys: \
:code:`'chatterjee_i'` of shape :code:`(num_vars, 1)`, \
- :code:`'CI_chatterjee_i'` of shape :code:`(num_vars, 2)`, \
+ :code:`'confidence_interval_chatterjee_i'` of shape :code:`(num_vars, 2)`, \
:code:`'sobol_i'` of shape :code:`(num_vars, 1)`.
"""
@@ -185,7 +185,7 @@ def run(
estimator_inputs = [A_samples, A_model_evals]
- self.CI_chatterjee_i = self.bootstrapping(
+ self.confidence_interval_chatterjee_i = self.bootstrapping(
self.compute_chatterjee_indices,
estimator_inputs,
computed_indices["chatterjee_i"],
@@ -197,7 +197,9 @@ def run(
"UQpy: Confidence intervals for Chatterjee indices computed successfully.\n"
)
- computed_indices["CI_chatterjee_i"] = self.CI_chatterjee_i
+ computed_indices[
+ "confidence_interval_chatterjee_i"
+ ] = self.confidence_interval_chatterjee_i
return computed_indices
diff --git a/src/UQpy/sensitivity/CramervonMises.py b/src/UQpy/sensitivity/CramervonMises.py
index f6507274..745557cd 100644
--- a/src/UQpy/sensitivity/CramervonMises.py
+++ b/src/UQpy/sensitivity/CramervonMises.py
@@ -79,7 +79,7 @@ def __init__(
self.CVM_i = None
"First order Cramér-von Mises indices, :class:`numpy.ndarray` of shape :code:`(num_vars, 1)`"
- self.CI_CVM_i = None
+ self.confidence_interval_CVM_i = None
"Confidence intervals of the first order Cramér-von Mises indices, :class:`numpy.ndarray` of shape :code:`(num_vars, 2)`"
self.sobol_i = None
@@ -124,7 +124,7 @@ def run(
:return: A :class:`dict` with the following keys: \
:code:`CVM_i` of shape :code:`(num_vars, 1)`, \
- :code:`CI_CVM_i` of shape :code:`(num_vars, 2)`, \
+ :code:`confidence_interval_CVM_i` of shape :code:`(num_vars, 2)`, \
:code:`sobol_i` of shape :code:`(num_vars, 1)`, \
:code:`sobol_total_i` of shape :code:`(num_vars, 1)`.
@@ -205,7 +205,7 @@ def run(
C_i_model_evals,
]
- self.CI_CVM_i = self.bootstrapping(
+ self.confidence_interval_CVM_i = self.bootstrapping(
self.pick_and_freeze_estimator,
estimator_inputs,
computed_indices["CVM_i"],
@@ -218,7 +218,9 @@ def run(
)
# Store the indices in the dictionary
- computed_indices["CI_CVM_i"] = self.CI_CVM_i
+ computed_indices[
+ "confidence_interval_CVM_i"
+ ] = self.confidence_interval_CVM_i
################## COMPUTE SOBOL INDICES ##################
diff --git a/src/UQpy/sensitivity/GeneralisedSobol.py b/src/UQpy/sensitivity/GeneralisedSobol.py
index 1b8764ca..2a976e00 100644
--- a/src/UQpy/sensitivity/GeneralisedSobol.py
+++ b/src/UQpy/sensitivity/GeneralisedSobol.py
@@ -113,8 +113,8 @@ def run(
:return: A :class:`dict` with the following keys: \
:code:`gen_sobol_i` of shape :code:`(num_vars, 1)`, \
:code:`gen_sobol_total_i` of shape :code:`(num_vars, 1)`, \
- :code:`CI_gen_sobol_i` of shape :code:`(num_vars, 2)`, \
- :code:`CI_gen_sobol_total_i` of shape :code:`(num_vars, 2)`.
+ :code:`confidence_interval_gen_sobol_i` of shape :code:`(num_vars, 2)`, \
+ :code:`confidence_interval_gen_sobol_total_i` of shape :code:`(num_vars, 2)`.
"""
@@ -225,7 +225,7 @@ def run(
]
# First order generalised Sobol indices
- self.CI_gen_sobol_i = self.bootstrapping(
+ self.confidence_interval_gen_sobol_i = self.bootstrapping(
self.compute_first_order_generalised_sobol_indices,
estimator_inputs,
computed_indices["gen_sobol_i"],
@@ -238,7 +238,7 @@ def run(
)
# Total order generalised Sobol indices
- self.CI_gen_sobol_total_i = self.bootstrapping(
+ self.confidence_interval_gen_sobol_total_i = self.bootstrapping(
self.compute_total_order_generalised_sobol_indices,
estimator_inputs,
computed_indices["gen_sobol_total_i"],
@@ -251,8 +251,12 @@ def run(
)
# Store the indices in the dictionary
- computed_indices["CI_gen_sobol_i"] = self.CI_gen_sobol_i
- computed_indices["CI_gen_sobol_total_i"] = self.CI_gen_sobol_total_i
+ computed_indices[
+ "confidence_interval_gen_sobol_i"
+ ] = self.confidence_interval_gen_sobol_i
+ computed_indices[
+ "confidence_interval_gen_sobol_total_i"
+ ] = self.confidence_interval_gen_sobol_total_i
return computed_indices
diff --git a/src/UQpy/sensitivity/Sobol.py b/src/UQpy/sensitivity/Sobol.py
index 99daec70..84e9b351 100644
--- a/src/UQpy/sensitivity/Sobol.py
+++ b/src/UQpy/sensitivity/Sobol.py
@@ -118,13 +118,13 @@ def __init__(
self.sobol_ij = None
"Second order Sobol indices, :class:`numpy.ndarray` of shape `(num_second_order_terms, n_outputs)`"
- self.CI_sobol_i = None
+ self.confidence_interval_sobol_i = None
"Confidence intervals for the first order Sobol indices, :class:`numpy.ndarray` of shape `(num_vars, 2)`"
- self.CI_sobol_total_i = None
+ self.confidence_interval_sobol_total_i = None
"Confidence intervals for the total order Sobol indices, :class:`numpy.ndarray` of shape `(num_vars, 2)`"
- self.CI_sobol_ij = None
+ self.confidence_interval_sobol_ij = None
"Confidence intervals for the second order Sobol indices, :class:`numpy.ndarray` of shape `(num_second_order_terms, 2)`"
self.n_samples = None
@@ -176,11 +176,11 @@ def run(
:code:`sobol_i` of shape :code:`(num_vars, 1)`, \
:code:`sobol_total_i` of shape :code:`(num_vars, 1)`, \
:code:`sobol_ij` of shape :code:`(num_second_order_terms, 1)`, \
- :code:`CI_sobol_i` of shape :code:`(num_vars, 2)`, \
+ :code:`confidence_interval_sobol_i` of shape :code:`(num_vars, 2)`, \
if multioutput: Shape: `(n_outputs, num_vars, 2)`, \
- :code:`CI_sobol_total_i` of shape :code:`(num_vars, 2)`, \
+ :code:`confidence_interval_sobol_total_i` of shape :code:`(num_vars, 2)`, \
if multioutput: Shape: `(n_outputs, num_vars, 2)`, \
- :code:`CI_sobol_ij` of shape :code:`(num_second_order_terms, 2)`
+ :code:`confidence_interval_sobol_ij` of shape :code:`(num_second_order_terms, 2)`
if multioutput: Shape: `(n_outputs, num_second_order_terms, 2)`, \
"""
@@ -321,7 +321,7 @@ def run(
]
# First order Sobol indices
- self.CI_sobol_i = self.bootstrapping(
+ self.confidence_interval_sobol_i = self.bootstrapping(
compute_first_order,
estimator_inputs,
computed_indices["sobol_i"],
@@ -334,10 +334,12 @@ def run(
"UQpy: Confidence intervals for First order Sobol indices computed successfully."
)
- computed_indices["CI_sobol_i"] = self.CI_sobol_i
+ computed_indices[
+ "confidence_interval_sobol_i"
+ ] = self.confidence_interval_sobol_i
# Total order Sobol indices
- self.CI_sobol_total_i = self.bootstrapping(
+ self.confidence_interval_sobol_total_i = self.bootstrapping(
compute_total_order,
estimator_inputs,
computed_indices["sobol_total_i"],
@@ -350,11 +352,13 @@ def run(
"UQpy: Confidence intervals for Total order Sobol indices computed successfully."
)
- computed_indices["CI_sobol_total_i"] = self.CI_sobol_total_i
+ computed_indices[
+ "confidence_interval_sobol_total_i"
+ ] = self.confidence_interval_sobol_total_i
# Second order Sobol indices
if estimate_second_order:
- self.CI_sobol_ij = self.bootstrapping(
+ self.confidence_interval_sobol_ij = self.bootstrapping(
compute_second_order,
estimator_inputs,
computed_indices["sobol_ij"],
@@ -368,7 +372,9 @@ def run(
"UQpy: Confidence intervals for Second order Sobol indices computed successfully."
)
- computed_indices["CI_sobol_ij"] = self.CI_sobol_ij
+ computed_indices[
+ "confidence_interval_sobol_ij"
+ ] = self.confidence_interval_sobol_ij
return computed_indices
diff --git a/tests/unit_tests/sensitivity/test_cramer_von_mises.py b/tests/unit_tests/sensitivity/test_cramer_von_mises.py
index c94ddbae..ed9a55b2 100644
--- a/tests/unit_tests/sensitivity/test_cramer_von_mises.py
+++ b/tests/unit_tests/sensitivity/test_cramer_von_mises.py
@@ -152,7 +152,7 @@ def bootstrap_CVM_index_variance(CVM_object, NUM_SAMPLES):
)
First_order = computed_indices["CVM_i"].ravel()
- upper_bound_first_order = computed_indices["CI_CVM_i"][:, 1]
+ upper_bound_first_order = computed_indices["confidence_interval_CVM_i"][:, 1]
#### Compute variance ####
std_bootstrap_first_order = (upper_bound_first_order - First_order) / delta
diff --git a/tests/unit_tests/sensitivity/test_generalised_sobol.py b/tests/unit_tests/sensitivity/test_generalised_sobol.py
index 3b5df316..0b1f0919 100644
--- a/tests/unit_tests/sensitivity/test_generalised_sobol.py
+++ b/tests/unit_tests/sensitivity/test_generalised_sobol.py
@@ -209,8 +209,10 @@ def bootstrap_generalised_sobol_index_variance(
gen_sobol_i = computed_indices["gen_sobol_i"].ravel()
gen_sobol_total_i = computed_indices["gen_sobol_total_i"].ravel()
- upper_bound_first_order = computed_indices["CI_gen_sobol_i"][:, 1]
- upper_bound_total_order = computed_indices["CI_gen_sobol_total_i"][:, 1]
+ upper_bound_first_order = computed_indices["confidence_interval_gen_sobol_i"][:, 1]
+ upper_bound_total_order = computed_indices["confidence_interval_gen_sobol_total_i"][
+ :, 1
+ ]
std_bootstrap_first_order = (upper_bound_first_order - gen_sobol_i) / delta
std_bootstrap_total_order = (upper_bound_total_order - gen_sobol_total_i) / delta
diff --git a/tests/unit_tests/sensitivity/test_sobol.py b/tests/unit_tests/sensitivity/test_sobol.py
index 3c1f1170..ff26801d 100644
--- a/tests/unit_tests/sensitivity/test_sobol.py
+++ b/tests/unit_tests/sensitivity/test_sobol.py
@@ -183,12 +183,14 @@ def bootstrap_sobol_index_variance(sobol_object, NUM_SAMPLES):
First_order = computed_indices["sobol_i"].ravel()
Total_order = computed_indices["sobol_total_i"].ravel()
- CI_first_order = computed_indices["CI_sobol_i"]
- CI_total_order = computed_indices["CI_sobol_total_i"]
+ confidence_interval_first_order = computed_indices["confidence_interval_sobol_i"]
+ confidence_interval_total_order = computed_indices[
+ "confidence_interval_sobol_total_i"
+ ]
#### Compute variance ####
- upper_bound_first_order = CI_first_order[:, 1]
- upper_bound_total_order = CI_total_order[:, 1]
+ upper_bound_first_order = confidence_interval_first_order[:, 1]
+ upper_bound_total_order = confidence_interval_total_order[:, 1]
std_bootstrap_first_order = (upper_bound_first_order - First_order) / delta
std_bootstrap_total_order = (upper_bound_total_order - Total_order) / delta