plot_keras_history/plot_keras_history.py
Function _plot_history
has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring. Open
Open
def _plot_history(
histories: List[pd.DataFrame],
average_history: Optional[pd.DataFrame] = None,
standard_deviation_history: Optional[pd.DataFrame] = None,
style: str = "-",
- Read upRead up
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
File plot_keras_history.py
has 504 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Methods for plotting a keras model training history."""
import warnings
import matplotlib.pyplot as plt
from typing import List, Dict, Union, Tuple, Callable, Optional
import os
Function plot_history
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
def plot_history(
histories: Union[History, List[History], Dict[str, List[float]], pd.DataFrame, List[pd.DataFrame], str, List[str]],
style: str = "-",
interpolate: bool = False,
side: float = 5,
- Read upRead up
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 _plot_history
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _plot_history(
Function plot_history
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def plot_history(
Function show_history
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def show_history(
Avoid deeply nested control flow statements. Open
Open
if show_standard_deviation and standard_deviation_history is not None:
axis.fill_between(
col.index.values,
values-standard_deviation_history[name].values,
values+standard_deviation_history[name].values,
Avoid deeply nested control flow statements. Open
Open
if min_value < 0.0 or max_value > 1.0:
warnings.warn(
(
"Please be advised that you have provided a metric called `{metric}` "
"that is expected to be normalized, i.e. between 0 and 1. The values "
Avoid deeply nested control flow statements. Open
Open
if min_value < -1.0 or max_value > 1.0:
warnings.warn(
(
"Please be advised that you have provided a metric called `{metric}` "
"that is expected to be absolutely normalized, i.e. between -1 and 1. The values "
Avoid deeply nested control flow statements. Open
Open
if best_point_x is not None:
best_point_y = col.values[best_point_x]
axis.scatter(
[best_point_x],
[best_point_y],
Avoid deeply nested control flow statements. Open
Open
if best_point_x is not None:
best_point_y = col.values[best_point_x]
if len(kind) == 0:
kind = f"Best value ({monitor})"
else: