HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/compat/keras_optimization_helper.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function link_choice_ids has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def link_choice_ids(layers, compile_params, extra_params, dimensions):
    """Update `extra_params` to include a "location" attribute on any descendants of
    :class:`space.Dimension`, specifying its position among all hyperparameters

    Parameters
Severity: Minor
Found in hyperparameter_hunter/compat/keras_optimization_helper.py - About 2 hrs 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 consolidate_layers has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def consolidate_layers(layers, class_name_key=True, split_args=False):
    """For each of the layer dicts in `layers`, merge the dict's keys to reflect the end value of
    the key, rather than its default value, and whether a value was explicitly given

    Parameters
Severity: Minor
Found in hyperparameter_hunter/compat/keras_optimization_helper.py - About 2 hrs 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 clean_parenthesized_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def clean_parenthesized_string(string):
    """Produce a clipped substring of `string` comprising all characters from the beginning of
    `string` through the closing paren that matches the first opening paren in `string`

    Parameters
Severity: Minor
Found in hyperparameter_hunter/compat/keras_optimization_helper.py - About 45 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 find_space_fragments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def find_space_fragments(string):
    """Locate and name all hyperparameter choice declaration fragments in `string`

    Parameters
    ----------
Severity: Minor
Found in hyperparameter_hunter/compat/keras_optimization_helper.py - About 35 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 initialize_dummy_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def initialize_dummy_model(model_initializer, build_fn, wrapper_params):
    """Creates a dummy model with placeholder values wherever hyperparameter options are provided
    via `hyperparameter_hunter.space` classes in order to produce a valid Keras model, albeit one
    with semi-useless values, which also contains attributes injected by
    :mod:`hyperparameter_hunter.importer`, and :mod:`hyperparameter_hunter.tracers` in order to
Severity: Minor
Found in hyperparameter_hunter/compat/keras_optimization_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

There are no issues that match your filters.

Category
Status