HunterMcGushion/hyperparameter_hunter

View on GitHub

Showing 89 of 104 total issues

Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, v_deprecate=None, v_remove=None, v_current=None, details=""):
        """Decorator to mark a function or class as deprecated. Issue warning when the function is
        called or the class is instantiated, and add a warning to the docstring. The optional
        `details` argument will be appended to the deprecation message and the docstring

Severity: Minor
Found in hyperparameter_hunter/utils/version_utils.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 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 obj
      Severity: Major
      Found in hyperparameter_hunter/keys/hashing.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return (tuple(pd.util.hash_pandas_object(obj, index=True)), tuple(obj.columns))
        Severity: Major
        Found in hyperparameter_hunter/keys/hashing.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 list(obj)
            Severity: Major
            Found in hyperparameter_hunter/utils/file_utils.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

                Avoid too many return statements within this function.
                Open

                            return (key, value)
                Severity: Major
                Found in hyperparameter_hunter/keys/makers.py - About 30 mins to fix

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

                  def get_keras_attr(model, attr, max_depth=3, default=sentinel_default_value):
                      """Retrieve specific Keras model attributes safely across different versions of Keras
                  
                      Parameters
                      ----------
                  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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __call__(cls, *args, **kwargs):
                          if getattr(G, "use_dummy_tracer", False) is True:
                              space = (Real, Integer, Categorical)
                              _args = [_ if not isinstance(_, space) else _.bounds[0] for _ in args]
                              _kwargs = {k: v if not isinstance(v, space) else v.bounds[0] for k, v in kwargs.items()}
                  Severity: Minor
                  Found in hyperparameter_hunter/tracers.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, v_str: str):
                          """Parse and compare HyperparameterHunter version strings
                  
                          Comparisons must be performed with a valid version string or another `HHVersion` instance.
                  
                  
                  Severity: Minor
                  Found in hyperparameter_hunter/utils/version_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 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 add_time_to_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def add_time_to_content(content, add_time=False):
                      """Construct a string containing the original `content`, in addition to the current time
                  
                      Parameters
                      ----------
                  Severity: Minor
                  Found in hyperparameter_hunter/i_o/reporting.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 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 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 _set_direction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _set_direction(self, direction):
                          """Ensure provided `direction` is valid and inferred if necessary
                  
                          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

                  Severity
                  Category
                  Status
                  Source
                  Language