alexandrebarachant/pyRiemann

View on GitHub
pyriemann/utils/mean.py

Summary

Maintainability
F
3 days
Test Coverage

File mean.py has 695 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Means of SPD/HPD matrices."""

from copy import deepcopy
import numpy as np
import warnings
Severity: Major
Found in pyriemann/utils/mean.py - About 1 day to fix

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

    def mean_power(X=None, p=None, *, sample_weight=None, zeta=10e-10, maxiter=100,
                   covmats=None):
        r"""Power mean of SPD/HPD matrices.
    
        Power mean of order p is the solution of [1]_ [2]_:
    Severity: Minor
    Found in pyriemann/utils/mean.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 maskedmean_riemann has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def maskedmean_riemann(X=None, masks=None, tol=10e-9, maxiter=100, init=None,
                           sample_weight=None, covmats=None):
        """Masked Riemannian mean of SPD/HPD matrices.
    
        Given masks defined as semi-orthogonal matrices, the masked Riemannian mean
    Severity: Minor
    Found in pyriemann/utils/mean.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 mean_riemann has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def mean_riemann(X=None, tol=10e-9, maxiter=50, init=None, sample_weight=None,
                     covmats=None):
        r"""Mean of SPD/HPD matrices according to the Riemannian metric.
    
        The affine-invariant Riemannian mean minimizes the sum of squared
    Severity: Minor
    Found in pyriemann/utils/mean.py - About 55 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 mean_alm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def mean_alm(X=None, tol=1e-14, maxiter=100, sample_weight=None, covmats=None):
        r"""Ando-Li-Mathias (ALM) mean of SPD/HPD matrices.
    
        Return the geometric mean recursively [1]_, generalizing from:
    
    
    Severity: Minor
    Found in pyriemann/utils/mean.py - About 55 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 mean_power has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def mean_power(X=None, p=None, *, sample_weight=None, zeta=10e-10, maxiter=100,
    Severity: Major
    Found in pyriemann/utils/mean.py - About 50 mins to fix

      Function maskedmean_riemann has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def maskedmean_riemann(X=None, masks=None, tol=10e-9, maxiter=100, init=None,
      Severity: Major
      Found in pyriemann/utils/mean.py - About 50 mins to fix

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

        def mean_wasserstein(X=None, tol=10e-4, maxiter=50, init=None,
        Severity: Minor
        Found in pyriemann/utils/mean.py - About 45 mins to fix

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

          def mean_riemann(X=None, tol=10e-9, maxiter=50, init=None, sample_weight=None,
          Severity: Minor
          Found in pyriemann/utils/mean.py - About 45 mins to fix

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

            def nanmean_riemann(X=None, tol=10e-9, maxiter=100, init=None,
            Severity: Minor
            Found in pyriemann/utils/mean.py - About 45 mins to fix

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

              def mean_logdet(X=None, tol=10e-5, maxiter=50, init=None, sample_weight=None,
              Severity: Minor
              Found in pyriemann/utils/mean.py - About 45 mins to fix

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

                def mean_alm(X=None, tol=1e-14, maxiter=100, sample_weight=None, covmats=None):
                Severity: Minor
                Found in pyriemann/utils/mean.py - About 35 mins to fix

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

                  def mean_ale(X=None, tol=10e-7, maxiter=50, sample_weight=None, covmats=None):
                  Severity: Minor
                  Found in pyriemann/utils/mean.py - About 35 mins to fix

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

                    def mean_covariance(X=None, metric="riemann", sample_weight=None, covmats=None,
                    Severity: Minor
                    Found in pyriemann/utils/mean.py - About 35 mins to fix

                      Function mean_wasserstein has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def mean_wasserstein(X=None, tol=10e-4, maxiter=50, init=None,
                                           sample_weight=None, covmats=None):
                          r"""Mean of SPD/HPD matrices according to the Wasserstein metric.
                      
                          Wasserstein mean is obtained by an iterative procedure where the update is
                      Severity: Minor
                      Found in pyriemann/utils/mean.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 mean_logdet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def mean_logdet(X=None, tol=10e-5, maxiter=50, init=None, sample_weight=None,
                                      covmats=None):
                          r"""Mean of SPD/HPD matrices according to the log-det metric.
                      
                          Log-det mean is obtained by an iterative procedure where the update is:
                      Severity: Minor
                      Found in pyriemann/utils/mean.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

                      There are no issues that match your filters.

                      Category
                      Status