kjappelbaum/pyepal

View on GitHub

Showing 103 of 103 total issues

Function sample has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sample(
        self,
        exclude_idx: Union[np.array, None] = None,
        pooling_method: str = "fro",
        sample_discarded: bool = False,
Severity: Minor
Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

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 augment_design_space has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def augment_design_space(  # pylint: disable=invalid-name
        self, X_design: np.ndarray, classify: bool = False, clean_classify: bool = True
    ) -> None:
        """Add new design points to PAL instance

Severity: Minor
Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

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_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

Severity: Minor
Found in src/pyepal/models/nt.py - About 25 mins to fix

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

Severity: Minor
Found in src/pyepal/pal/validate_inputs.py - About 25 mins to fix

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:
Severity: Minor
Found in src/pyepal/pal/validate_inputs.py - About 25 mins to fix

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]
Severity: Minor
Found in src/pyepal/pal/utils.py - About 25 mins to fix

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",
Severity: Minor
Found in src/pyepal/pal/utils.py - About 25 mins to fix

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
Severity: Minor
Found in src/pyepal/pal/utils.py - About 25 mins to fix

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
Severity: Minor
Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

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

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert len(hidden_layers) >= 1, "You must provide at least one hidden layer"
Severity: Info
Found in src/pyepal/models/nt.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self.multilist is not None
Severity: Info
Found in src/pyepal/pal/_hypervolume.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(
        model, GPy.models.GPRegression
    ), "This wrapper function is written for GPy.models.GPRegression"
Severity: Info
Found in src/pyepal/models/gpr.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert node is not None
Severity: Info
Found in src/pyepal/pal/_hypervolume.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(self.restarts, int), "the restarts keyword must be of type int"

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert len(indices) > 5, "You need to use at least five points"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert len(activations) == len(
        hidden_layers
    ), "The number of hidden layers should match the number of nonlinearities"
Severity: Info
Found in src/pyepal/models/nt.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(unclassified_points, np.ndarray), "The arguments must be numpy arrays"

Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(y, np.ndarray), "Input array y must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert y.ndim == 2, "y must be a two-dimensional numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert isinstance(y, np.ndarray), "Input array y must be a numpy array"
Severity: Info
Found in src/pyepal/plotting/__init__.py by bandit
Severity
Category
Status
Source
Language