HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/metrics.py

Summary

Maintainability
B
5 hrs
Test Coverage

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

    def _validate_metrics_list_parameters(self):
        """Ensure metrics lists input parameters are correct types and compatible with each other"""
        for (_d_type, _m_val) in [(_, getattr(self, f"_ScoringMixIn{_}")) for _ in data_types]:
            if _m_val == "all":
                setattr(self, f"_ScoringMixIn{_d_type}", list(self.metrics.keys()))
Severity: Minor
Found in hyperparameter_hunter/metrics.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 format_metrics has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def format_metrics(metrics: Union[Dict, List]) -> Dict[str, Metric]:
    """Properly format iterable `metrics` to contain instances of :class:`Metric`

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

def get_formatted_target_metric(
    target_metric: Union[tuple, str, None], metrics: dict, default_dataset: str = "oof"
) -> Tuple[str, str]:
    """Return a properly formatted target_metric tuple for use with navigating evaluation results

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

def get_clean_prediction(target: ArrayLike, prediction: ArrayLike):
    """Create `prediction` that is of a form comparable to `target`

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

There are no issues that match your filters.

Category
Status