HunterMcGushion/hyperparameter_hunter

View on GitHub

Showing 92 of 104 total issues

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

    def __init__(
        self,
        dimensions,
        base_estimator="gp",
        n_initial_points=10,
Severity: Minor
Found in hyperparameter_hunter/optimization/backends/skopt/engine.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 results_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def results_path(self, value):
        self._results_path = value
        if self._results_path is None:
            G.warn("Received results_path=None. Results will not be stored at all.")
        elif isinstance(self._results_path, str):
Severity: Minor
Found in hyperparameter_hunter/environment.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 forge_experiment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def forge_experiment(
        self,
        model_initializer,
        model_init_params=None,
        model_extra_params=None,
Severity: Minor
Found in hyperparameter_hunter/optimization/protocol_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

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

    def __eq__(self, other):
        for attr in ["d", "run", "fold", "rep", "final"]:
            if getattr(self, attr) is None:
                if getattr(other, attr) is not None:
                    return False
Severity: Minor
Found in hyperparameter_hunter/data/data_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

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 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 (key, value)
      Severity: Major
      Found in hyperparameter_hunter/keys/makers.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

            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 Categorical(dimension, **kwargs)
                Severity: Major
                Found in hyperparameter_hunter/space/space_core.py - About 30 mins to fix

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

                  def reinitialize_callbacks(callbacks):
                      """Ensures the contents of `callbacks` are valid Keras callbacks
                  
                      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 visit_Return has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def visit_Return(self, node):
                          try:
                              self.returns.append(node.value.id)
                          except AttributeError:
                              for element in node.value.elts:
                  Severity: Minor
                  Found in hyperparameter_hunter/feature_engineering.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 _validate_estimator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _validate_estimator(estimator: EstTypes, *valid_values: EstTypes) -> Optional[bool]:
                      # TODO: Add docstring
                      for valid_value in valid_values:
                          if isinstance(valid_value, str) and estimator == valid_value.upper():
                              return True
                  Severity: Minor
                  Found in hyperparameter_hunter/optimization/backends/skopt/protocols.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 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

                  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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language