alexandrebarachant/pyRiemann

View on GitHub

Showing 138 of 185 total issues

File classification.py has 884 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Module for classification function."""
import functools

import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin
Severity: Major
Found in pyriemann/classification.py - About 2 days to fix

    File _estimators.py has 813 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import numpy as np
    from joblib import Parallel, delayed
    from sklearn.base import (
        BaseEstimator,
        TransformerMixin,
    Severity: Major
    Found in pyriemann/transfer/_estimators.py - About 1 day to fix

      File estimation.py has 792 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Estimation of SPD matrices."""
      import numpy as np
      from sklearn.base import BaseEstimator, TransformerMixin
      from sklearn.covariance import shrunk_covariance
      from sklearn.metrics.pairwise import pairwise_kernels
      Severity: Major
      Found in pyriemann/estimation.py - About 1 day to fix

        File mean.py has 693 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

          File covariance.py has 673 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import warnings
          from functools import wraps
          
          import numpy as np
          from scipy.linalg import block_diag
          Severity: Major
          Found in pyriemann/utils/covariance.py - About 1 day to fix

            File clustering.py has 666 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """Clustering functions."""
            import numpy as np
            from joblib import Parallel, delayed
            from scipy.stats import norm, chi2
            import sklearn
            Severity: Major
            Found in pyriemann/clustering.py - About 1 day to fix

              File spatialfilters.py has 642 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """Spatial filtering function."""
              import warnings
              
              import numpy as np
              from scipy.linalg import eigh, inv
              Severity: Major
              Found in pyriemann/spatialfilters.py - About 1 day to fix

                File distance.py has 549 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """Distances between SPD/HPD matrices."""
                
                import numpy as np
                from scipy.linalg import eigvalsh, solve
                from sklearn.metrics import euclidean_distances
                Severity: Major
                Found in pyriemann/utils/distance.py - About 1 day to fix

                  File sampling.py has 467 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from functools import partial
                  import warnings
                  import numpy as np
                  from scipy.stats import multivariate_normal
                  from sklearn.utils import check_random_state
                  Severity: Minor
                  Found in pyriemann/datasets/sampling.py - About 7 hrs to fix

                    File embedding.py has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    """Embedding SPD matrices via manifold learning techniques."""
                    
                    import warnings
                    
                    import numpy as np
                    Severity: Minor
                    Found in pyriemann/embedding.py - About 4 hrs to fix

                      File stats.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import sys
                      import math
                      import numpy as np
                      from sklearn.model_selection import cross_val_score
                      
                      
                      Severity: Minor
                      Found in pyriemann/stats.py - About 4 hrs to fix

                        File simulated.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import numpy as np
                        from sklearn.utils.validation import check_random_state
                        
                        from ..utils.mean import mean_riemann
                        from ..utils.distance import distance_riemann
                        Severity: Minor
                        Found in pyriemann/datasets/simulated.py - About 4 hrs to fix

                          Function plot_waveforms has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def plot_waveforms(X, display, *, times=None, color="gray", alpha=0.5,
                                             linewidth=1.5, color_mean="k", color_std="gray", n_bins=50,
                                             cmap=None):
                              """Plot repetitions of a multichannel waveform.
                          
                          
                          Severity: Minor
                          Found in pyriemann/utils/viz.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

                          File tangentspace.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          """Tangent space for SPD/HPD matrices."""
                          
                          import numpy as np
                          
                          from .base import sqrtm, invsqrtm, logm, expm
                          Severity: Minor
                          Found in pyriemann/utils/tangentspace.py - About 3 hrs to fix

                            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

                              File viz.py has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              """Helpers for vizualization."""
                              import matplotlib.pyplot as plt
                              from matplotlib.patches import Ellipse
                              import matplotlib.transforms as transforms
                              import numpy as np
                              Severity: Minor
                              Found in pyriemann/utils/viz.py - About 3 hrs to fix

                                File tangentspace.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                """Tangent space functions."""
                                import numpy as np
                                from sklearn.base import BaseEstimator, TransformerMixin
                                from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
                                
                                
                                Severity: Minor
                                Found in pyriemann/tangentspace.py - About 2 hrs to fix

                                  Function cross_spectrum has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def cross_spectrum(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None):
                                      """Compute the complex cross-spectral matrices of a real signal X.
                                  
                                      Parameters
                                      ----------
                                  Severity: Minor
                                  Found in pyriemann/utils/covariance.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 fit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def fit(self, X, y):
                                          """Train CSP spatial filters.
                                  
                                          Parameters
                                          ----------
                                  Severity: Minor
                                  Found in pyriemann/spatialfilters.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 covariance_mest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def covariance_mest(X, m_estimator, *, init=None, tol=10e-3, n_iter_max=50,
                                                      assume_centered=False, q=0.9, nu=5, norm="trace"):
                                      r"""Robust M-estimators.
                                  
                                      Robust M-estimator based covariance matrix [1]_, computed by fixed point
                                  Severity: Minor
                                  Found in pyriemann/utils/covariance.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language