Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert alpha > 0
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert len(clean_goals) == ndim
- Exclude checks
Function validate_goals
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def validate_goals(goals: Any, ndim: int) -> np.ndarray: # pylint:disable=too-many-branches
"""Create a valid array of goals. 1 for maximization, -1
for objectives that are to be minimized.
Args:
- 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
File validate_inputs.py
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Copyright 2020 PyePAL authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Function validate_epsilon
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate_epsilon(epsilon: Any, ndim: int) -> np.ndarray:
"""Validate epsilon and return a np.array
Args:
epsilon (Any): Epsilon hyperparameter
- 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_gbdt_models
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_gbdt_models(models: Any, ndim: int) -> List[Iterable]:
"""Make sure that the number of iterables is equal to the number of objectives
and that every iterable contains three LGBMRegressors.
Also, we check that at least the first and last models use quantile loss"""
- 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_positive_integer_list
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_positive_integer_list(
seq: Any, ndim: int, parameter_name: str = "Parameter"
) -> Sequence[int]:
"""Can be used, e.g., to validate and standardize the ensemble size
and epochs input"""
- 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"