w4k2/stream-learn

View on GitHub

Showing 40 of 131 total issues

Function __str__ has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    def __str__(self):
        if type(self.y_flip) == tuple and type(self.weights) != tuple:
            return "%s_%s_css%i_rs%i_nd%i_ln%i_%i_d%i_%i" % (
                "gr" if self.incremental is False else "inc",
                "n" if self.recurring is False else "r",
Severity: Minor
Found in strlearn/streams/StreamGenerator.py - About 1 day 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 partial_fit has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def partial_fit(self, X, y, classes=None):
        super().partial_fit(X, y, classes)
        if not self.green_light:
            return self
        
Severity: Minor
Found in strlearn/ensembles/ROSE.py - About 6 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 _make_classification has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def _make_classification(self):
        np.random.seed(self.random_state)
        # Using concept with weights from the rows of a diagonal matrix
        self.concepts = np.array(
            [
Severity: Minor
Found in strlearn/streams/StreamGenerator.py - About 6 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

File StreamGenerator.py has 389 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
from scipy.stats import logistic
from sklearn.datasets import make_classification
import csv

Severity: Minor
Found in strlearn/streams/StreamGenerator.py - About 5 hrs to fix

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

        def __init__(self, path, chunk_size=200, n_chunks=250):
            # Read file.
            self.name = path
            self._f = open(path, "r")
            self.chunk_size = chunk_size
    Severity: Minor
    Found in strlearn/streams/ARFFParser.py - About 4 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 partial_fit has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def partial_fit(self, X, y, classes=None):
            super().partial_fit(X, y, classes)
            if not self.green_light:
                return self
    
    
    Severity: Minor
    Found in strlearn/ensembles/CDS.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

    Consider simplifying this complex logical expression.
    Open

            if type(self.y_flip) == tuple and type(self.weights) != tuple:
                return "%s_%s_css%i_rs%i_nd%i_ln%i_%i_d%i_%i" % (
                    "gr" if self.incremental is False else "inc",
                    "n" if self.recurring is False else "r",
                    999
    Severity: Critical
    Found in strlearn/streams/StreamGenerator.py - About 2 hrs to fix

      Function partial_fit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def partial_fit(self, X, y, classes=None):
              super().partial_fit(X, y, classes)
              if not self.green_light:
                  return self
      
      
      Severity: Minor
      Found in strlearn/ensembles/KUE.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 partial_fit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def partial_fit(self, X, y, classes=None):
              super().partial_fit(X, y, classes)
              if not self.green_light:
                  return self
      
      
      Severity: Minor
      Found in strlearn/ensembles/UOB.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 partial_fit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def partial_fit(self, X, y, classes=None):
              super().partial_fit(X, y, classes)
              if not self.green_light:
                  return self
      
      
      Severity: Minor
      Found in strlearn/ensembles/OOB.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 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in strlearn/streams/StreamGenerator.py - About 2 hrs to fix

        Function partial_fit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def partial_fit(self, X, y, classes=None):
                super().partial_fit(X, y, classes)
                if not self.green_light:
                    return self
        
        
        Severity: Minor
        Found in strlearn/ensembles/DWM.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 process has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self, stream, clfs, interval=100):
                """
                Perform learning procedure on data stream.
        
                :param stream: Data stream as an object
        Severity: Minor
        Found in strlearn/evaluators/Prequential.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_chunk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_chunk(self):
                """
                Generating a data chunk of a stream.
        
                Used by all evaluators but also accesible for custom evaluation.
        Severity: Minor
        Found in strlearn/streams/ARFFParser.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 process has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self, stream, clfs):
                """
                Perform learning procedure on data stream.
        
                :param stream: Data stream as an object
        Severity: Minor
        Found in strlearn/evaluators/SparseTrainDenseTest.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 _calculate_weights has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _calculate_weights(self, X, y):
                beta = []
                for i in range(len(self.ensemble_)):
                    epsilon = 1-f1_score(y, self._sub_ensemble_predict(i, X))
                    if epsilon > 0.5:
        Severity: Minor
        Found in strlearn/ensembles/NIE.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 process has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self, stream, clfs):
                """
                Perform learning procedure on data stream.
        
                :param stream: Data stream as an object
        Severity: Minor
        Found in strlearn/evaluators/TestThenTrain.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 partial_fit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def partial_fit(self, X, y, classes=None):
                super().partial_fit(X, y, classes)
                if not self.green_light:
                    return self
        
        
        Severity: Minor
        Found in strlearn/ensembles/KMC.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 feed has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def feed(self, X, y, pred):
        
                self.count+=1
        
                # Init: tabele, wielkość podprzestrzeni, losowanie podprzestrzenie
        Severity: Minor
        Found in strlearn/detectors/SDDE.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 feed has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def feed(self, X, real, pred):
        
                if len(pred) != len(real):
                    self.drift.append(0)
                    self._is_drift = False
        Severity: Minor
        Found in strlearn/detectors/EDDM.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

        Severity
        Category
        Status
        Source
        Language