Skip to content

Commit

Permalink
Update strings ensemble.py
Browse files Browse the repository at this point in the history
Changed strings to constants stored in C.py.
  • Loading branch information
vwiela authored Oct 9, 2023
1 parent 727056f commit 686e4a3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pypesto/ensemble/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
X_VECTOR,
EnsembleType,
ModeType,
SIMULTANEOUS,
POINTWISE
)
from ..engine import (
Engine,
Expand Down Expand Up @@ -1207,7 +1209,7 @@ def get_percentile_label(percentile: Union[float, int, str]) -> str:
def calculate_cutoff(
result: Result,
percentile: float = 0.95,
cr_option: str = 'simultaneous',
cr_option: str = SIMULTANEOUS,
):
"""
Calculate the cutoff of the ensemble.
Expand Down Expand Up @@ -1238,17 +1240,17 @@ def calculate_cutoff(
f"percentile={percentile} is too large. Choose "
f"0<=percentile<=100."
)
if cr_option not in ["simultaneous", "pointwise"]:
if cr_option not in [SIMULTANEOUS, POINTWISE]:
raise ValueError(
"Confidence region must be either simultaneous or pointwise."
)

# optimal point as base:
fval_opt = result.optimize_result[0].fval
if cr_option == 'simultaneous':
if cr_option == SIMULTANEOUS:
# degrees of freedom is equal to the number of parameters
df = result.problem.dim
elif cr_option == 'pointwise':
elif cr_option == POINTWISE:
# degrees of freedom is equal to 1
df = 1

Expand Down

0 comments on commit 686e4a3

Please sign in to comment.