alexandrebarachant/pyRiemann

View on GitHub
pyriemann/utils/ajd.py

Summary

Maintainability
C
1 day
Test Coverage

File ajd.py has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Aproximate joint diagonalization algorithms."""

import numpy as np
import warnings

Severity: Minor
Found in pyriemann/utils/ajd.py - About 3 hrs to fix

    Function rjd has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def rjd(X, *, init=None, eps=1e-8, n_iter_max=100):
        """Approximate joint diagonalization based on JADE.
    
        This is an implementation of the orthogonal AJD algorithm [1]_: joint
        approximate diagonalization of eigen-matrices (JADE), based on Jacobi
    Severity: Minor
    Found in pyriemann/utils/ajd.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 ajd_pham has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def ajd_pham(X, *, init=None, eps=1e-6, n_iter_max=20, sample_weight=None):
        """Approximate joint diagonalization based on Pham's algorithm.
    
        This is a direct implementation of the AJD algorithm [1]_, optimizing a
        log-likelihood criterion based on the Kullback-Leibler divergence.
    Severity: Minor
    Found in pyriemann/utils/ajd.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 ajd has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def ajd(X, method="ajd_pham", init=None, eps=1e-6, n_iter_max=100, **kwargs):
    Severity: Minor
    Found in pyriemann/utils/ajd.py - About 45 mins to fix

      Function ajd_pham has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ajd_pham(X, *, init=None, eps=1e-6, n_iter_max=20, sample_weight=None):
      Severity: Minor
      Found in pyriemann/utils/ajd.py - About 45 mins to fix

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

        def uwedge(X, *, init=None, eps=1e-7, n_iter_max=100):
            """Approximate joint diagonalization based on UWEDGE.
        
            This is an implementation of the AJD algorithm [1]_ [2]_: uniformly
            weighted exhaustive diagonalization using Gauss iterations (U-WEDGE).
        Severity: Minor
        Found in pyriemann/utils/ajd.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 rjd has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def rjd(X, *, init=None, eps=1e-8, n_iter_max=100):
        Severity: Minor
        Found in pyriemann/utils/ajd.py - About 35 mins to fix

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

          def uwedge(X, *, init=None, eps=1e-7, n_iter_max=100):
          Severity: Minor
          Found in pyriemann/utils/ajd.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status