HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/space/space_core.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function check_dimension has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def check_dimension(dimension, transform=None):
    """Turn a provided dimension description into a dimension object. Checks that the provided
    dimension falls into one of the supported types, listed below in the description of `dimension`

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

def normalize_dimensions(dimensions):
    """Create a `Space` where all dimensions are instructed to be normalized to unit range. Note
    that this doesn't *really* return normalized `dimensions`. It just returns the given
    `dimensions`, with each one's `transform` set to the appropriate value, so that when each
    dimension's :meth:`transform` is called, the dimensions are actually normalized
Severity: Minor
Found in hyperparameter_hunter/space/space_core.py - About 1 hr 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 rvs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def rvs(self, n_samples=1, random_state=None):
        """Draw random samples. Samples are in the original (untransformed) space. They must be
        transformed before being passed to a model or minimizer via :meth:`transform`

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

    def inverse_transform(self, data_t):
        """Inverse transform samples from the warped space back to the original space

        Parameters
        ----------
Severity: Minor
Found in hyperparameter_hunter/space/space_core.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

Avoid too many return statements within this function.
Open

        return Categorical(dimension, **kwargs)
Severity: Major
Found in hyperparameter_hunter/space/space_core.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return Real(*dimension, **kwargs)
    Severity: Major
    Found in hyperparameter_hunter/space/space_core.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return Real(*dimension, **kwargs)
      Severity: Major
      Found in hyperparameter_hunter/space/space_core.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return Categorical(dimension, **kwargs)
        Severity: Major
        Found in hyperparameter_hunter/space/space_core.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status