HunterMcGushion/hyperparameter_hunter

View on GitHub

Showing 89 of 104 total issues

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

    def validate_environment(self):
        """Check that the currently active Environment is suitable"""
        if G.Env is None:
            raise EnvironmentInactiveError("")
        if not all([hasattr(G.Env, _) for _ in ["result_paths", "cross_experiment_key"]]):
Severity: Minor
Found in hyperparameter_hunter/keys/makers.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 evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def evaluate(self, data_type, target, prediction, return_list=False, dry_run=False):
        """Apply metric(s) to the given data to calculate the value of the `prediction`

        Parameters
        ----------
Severity: Minor
Found in hyperparameter_hunter/metrics.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 extra_enter_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def extra_enter_attrs(iter_attrs: Union[BooleanEnterFunc, List[BooleanEnterFunc]]) -> EnterFunc:
    """Build an `enter` function intended for use with `boltons_utils.remap` that enables entrance
    into non-standard objects defined by `iter_attrs` and iteration over their attributes as dicts

    Parameters
Severity: Minor
Found in hyperparameter_hunter/utils/general_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 evaluations_to_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def evaluations_to_columns(
    evaluation: Dict[str, Optional[OrderedDict]], decimals=10
) -> List[Tuple[str, Number]]:
    """Convert the results of :meth:`metrics.ScoringMixIn.evaluate` to a pd.DataFrame-ready format

Severity: Minor
Found in hyperparameter_hunter/i_o/leaderboards.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_keras_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_keras_params(self):
        """Ensure provided input parameters are properly formatted"""
        #################### Check Keras Import Hooks ####################
        necessary_import_hooks = ["keras_layer"]
        for hook in necessary_import_hooks:
Severity: Minor
Found in hyperparameter_hunter/models.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 keras_initializer_to_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def keras_initializer_to_dict(initializer):
    try:
        #################### Descendants of `VarianceScaling` ####################
        previous_frame = getattr(initializer, "__hh_previous_frame")
    except AttributeError:
Severity: Minor
Found in hyperparameter_hunter/compat/keras_helper.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 acq_optimizer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def acq_optimizer(self, value):
        # Decide optimizer based on gradient information
        if value == "auto":
            if has_gradients(self.base_estimator):
                value = "lbfgs"
Severity: Minor
Found in hyperparameter_hunter/optimization/backends/skopt/engine.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 visit_feature_engineer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def visit_feature_engineer(path, key, value):
    """Helper to be used within a `visit` function intended for a `remap`-like function

    Parameters
    ----------
Severity: Minor
Found in hyperparameter_hunter/utils/optimization_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 extract_imports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def extract_imports(source):
    """(Taken from `hyperas.utils`). Construct a string containing all imports from `source`

    Parameters
    ----------
Severity: Minor
Found in hyperparameter_hunter/utils/parsing_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

Severity
Category
Status
Source
Language