paradoxysm/sleepens

View on GitHub

Showing 7 of 31 total issues

Function _cross_validate_timeseries has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
Open

def _cross_validate_timeseries(estimator, X, Y, cv, repeat, random_state,
                    shuffle, verbose):
    """
    Conduct a k-fold cross validation on a TimeSeriesClassifier.

Severity: Minor
Found in sleepens/ml/_cv.py - About 3 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 balance has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
Open

def balance(data, labels, desired=None, balance='auto',
                            seed=None, verbose=0):
    """
    Balance a dataset through generative oversampling.
Severity: Minor
Found in sleepens/utils/data/sampling.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 __init__ has 20 arguments (exceeds 10 allowed). Consider refactoring.
Open

    def __init__(self, loss='deviance', learning_rate=0.1, n_estimators=100,
Severity: Major
Found in sleepens/ml/models/_gb.py - About 1 hr to fix

    Function _cross_validate_classic has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
    Open

    def _cross_validate_classic(estimator, X, Y, cv, repeat, random_state,
                        shuffle, verbose):
        """
        Conduct a k-fold cross validation on a Classifier.
    
    
    Severity: Minor
    Found in sleepens/ml/_cv.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 REMSensitivity has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    def REMSensitivity(Y_hat, p, map=default_map, avg_threshold=0.08, init_threshold=0.03,
                    min_threshold=0.02, window=2, min_size=3):
        """
        REM Sensitivity Addon. Increase the sensitivity of predictions
        to favour REM sleep episodes.
    Severity: Minor
    Found in sleepens/postprocess/_rem_sensitivity.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 feature_importance has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

        def feature_importance(self, X, Y, repeats=10, sort=True):
            """
            Return the importances of features through Permutation
            Feature Importance (PFI). In PFI, the fitted classifier
            predicts over data where one feature has been permuted randomly.
    Severity: Minor
    Found in sleepens/ml/_base_model.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 TransitionFix has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    def TransitionFix(Y_hat, p, transitions=default):
        """
        Transition Fix Addon. Ensure predictions follow
        physiologically feasible state transitions.
    
    
    Severity: Minor
    Found in sleepens/postprocess/_transition_fix.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