sylvchev/mdla

View on GitHub
mdla/mdla.py

Summary

Maintainability
F
1 wk
Test Coverage

File mdla.py has 1246 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Multivariate dictionary learning"""
# Author: Sylvain Chevallier
# License: GPL v3

import itertools
Severity: Major
Found in mdla/mdla.py - About 3 days to fix

    Function multivariate_dict_learning has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def multivariate_dict_learning(
        X,
        n_kernels,
        n_nonzero_coefs=1,
        max_iter=100,
    Severity: Minor
    Found in mdla/mdla.py - About 5 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 _multivariate_OMP has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def _multivariate_OMP(signal, dictionary, n_nonzero_coefs=None, verbose=False):
        """Sparse coding multivariate signal with OMP
    
        Returns residual and a decomposition array (n_nonzero_coefs, 3),
        each line indicating (amplitude, offset, kernel).
    Severity: Minor
    Found in mdla/mdla.py - About 5 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 multivariate_dict_learning_online has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def multivariate_dict_learning_online(
        X,
        n_kernels=2,
        n_nonzero_coefs=1,
        n_iter=100,
    Severity: Minor
    Found in mdla/mdla.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 _compute_gradient has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _compute_gradient(
        dictionary,
        decomposition,
        residual,
        learning_rate=None,
    Severity: Minor
    Found in mdla/mdla.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 multivariate_dict_learning_online has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def multivariate_dict_learning_online(
    Severity: Major
    Found in mdla/mdla.py - About 1 hr to fix

      Function multivariate_dict_learning has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def multivariate_dict_learning(
      Severity: Major
      Found in mdla/mdla.py - About 1 hr to fix

        Function __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in mdla/mdla.py - About 1 hr to fix

          Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in mdla/mdla.py - About 1 hr to fix

            Function _multivariate_OMP has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def _multivariate_OMP(signal, dictionary, n_nonzero_coefs=None, verbose=False):
                """Sparse coding multivariate signal with OMP
            
                Returns residual and a decomposition array (n_nonzero_coefs, 3),
                each line indicating (amplitude, offset, kernel).
            Severity: Minor
            Found in mdla/mdla.py - About 1 hr to fix

              Function multivariate_sparse_encode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def multivariate_sparse_encode(
                  X, dictionary, n_nonzero_coefs=None, n_jobs=1, verbose=False
              ):
                  """Sparse coding
              
              
              Severity: Minor
              Found in mdla/mdla.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 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def partial_fit(self, X, y=None, iter_offset=None):
                      """Updates the model using the data in X as a mini-batch.
              
                      Parameters
                      ----------
              Severity: Minor
              Found in mdla/mdla.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 _update_dict has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _update_dict(
              Severity: Minor
              Found in mdla/mdla.py - About 45 mins to fix

                Function _update_dict has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def _update_dict(
                    dictionary,
                    decomposition,
                    residual,
                    learning_rate=None,
                Severity: Minor
                Found in mdla/mdla.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 fit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fit(self, X, y=None):
                        """Fit the model from data in X.
                
                        Parameters
                        ----------
                Severity: Minor
                Found in mdla/mdla.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 fit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fit(self, X, y=None):
                        """Fit the model from data in X.
                
                        Parameters
                        ----------
                Severity: Minor
                Found in mdla/mdla.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 _compute_gradient has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _compute_gradient(
                Severity: Minor
                Found in mdla/mdla.py - About 45 mins to fix

                  Function multivariate_sparse_encode has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def multivariate_sparse_encode(
                  Severity: Minor
                  Found in mdla/mdla.py - About 35 mins to fix

                    Function array3d has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def array3d(X, dtype=None, order=None, copy=False, force_all_finite=True):
                    Severity: Minor
                    Found in mdla/mdla.py - About 35 mins to fix

                      Function _set_mdla_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def _set_mdla_params(
                      Severity: Minor
                      Found in mdla/mdla.py - About 35 mins to fix

                        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(
                        Severity: Minor
                        Found in mdla/mdla.py - About 35 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status