Showing 47 of 103 total issues
Function get_optimizer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_optimizer(
learning_rate: float = 1e-4, optimizer="sdg", optimizer_kwargs: dict = None
) -> JaxOptimizer:
"""Return a `JaxOptimizer` dataclass for a JAX optimizer
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate_nt_models
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_nt_models(models: Any, ndim: int) -> Sequence:
"""Make sure that we can work with a sequence of
:py:func:`pyepal.pal.models.nt.NTModel`"""
from pyepal.models.nt import NTModel # pylint:disable=import-outside-toplevel
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _validate_sklearn_gpr_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _validate_sklearn_gpr_model(model: Any) -> GaussianProcessRegressor:
"""Make sure that we deal with a GaussianProcessRegressor instance,
if it is a fitted random or grid search instance, extract the model"""
if isinstance(model, (RandomizedSearchCV, GridSearchCV)):
try:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function dominance_check_jitted_3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dominance_check_jitted_3(array: np.array, point: np.array, ignore_me: int) -> bool:
"""Check if any point in array dominates point. ignore_me
since numba does not understand masked arrays"""
sorted_idx = array[:, 0].argsort()[::-1]
ignore_me = np.where(sorted_idx == ignore_me)[0][0]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_maxmin_samples
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_maxmin_samples( # pylint:disable=invalid-name
X: np.array,
n_samples: int,
metric: str = "euclidean",
init: str = "mean",
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_nondimensional_pareto_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_nondimensional_pareto_error(
y_true: np.ndarray, y_pred: np.ndarray, ranges: np.ndarray
) -> float:
"""Calculates a non-dimensional error metric,
the scaled minimum maximum average distance of a Pareto-optimal
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _crossvalidate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _crossvalidate(self):
sampled_original = deepcopy(self.sampled)
sampled_idx_original = self.sampled_indices
errors = []
# this step is to make the code not to complicate
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"