HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/optimization/protocol_core.py

Summary

Maintainability
B
4 hrs
Test Coverage

BaseOptPro has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class BaseOptPro(metaclass=MergedOptProMeta):
    source_script: str

    def __init__(
        self,
Severity: Minor
Found in hyperparameter_hunter/optimization/protocol_core.py - About 2 hrs to fix

    Function _optimization_loop has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _optimization_loop(self, iteration=0):
            """Perform Experiment execution loop while `iteration` < `iterations`. At each iteration, an
            Experiment will be executed, its results will be logged, and it will be compared to the
            current best experiment
    
    
    Severity: Minor
    Found in hyperparameter_hunter/optimization/protocol_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 _clean_up_optimization has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _clean_up_optimization():
            """Perform any cleanup necessary after completion of the optimization loop. Most notably,
            this handles removal of temporary model files created for Keras optimization"""
            for (root, dirs, files) in walk(TEMP_MODULES_DIR_PATH, topdown=False):
                for file in files:
    Severity: Minor
    Found in hyperparameter_hunter/optimization/protocol_core.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 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

    There are no issues that match your filters.

    Category
    Status