yzhao062/Pyod

View on GitHub

Showing 77 of 265 total issues

Function _check_params has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _check_params(n_iter, dis_measure, random_state):
    """Internal function to check for and validate class parameters.
    Also, to return random state instance and the appropriate dissimilarity
    measure if valid.
    """
Severity: Minor
Found in pyod/models/lmdd.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 fit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def fit(self, X, y=None):
        """Fit detector. y is assumed to be 0 for all training samples.
        Parameters
        ----------
        X : numpy array of shape (n_samples, n_features)
Severity: Minor
Found in pyod/models/lunar.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 fit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def fit(self, X, y=None):
        """Fit detector. y is ignored in unsupervised methods.

        Parameters
        ----------
Severity: Minor
Found in pyod/models/anogan.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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,
Severity: Major
Found in pyod/models/dif.py - About 1 hr to fix

    Function explain_outlier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def explain_outlier(self, ind, columns=None, cutoffs=None,
                            feature_names=None, file_name=None,
                            file_type=None):  # pragma: no cover
            """Plot dimensional outlier graph for a given data point within
            the dataset.
    Severity: Minor
    Found in pyod/models/copod.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_local_region has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_local_region(self, X_test_norm):
            """ Get local region for each test instance
    
            Parameters
            ----------
    Severity: Minor
    Found in pyod/models/lscp.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 fit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def fit(self, X, y=None):
            """Fit detector. y is ignored in unsupervised methods.
    
            Parameters
            ----------
    Severity: Minor
    Found in pyod/models/inne.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 train_step has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def train_step(self, data):
            cross_entropy = tf.keras.losses.BinaryCrossentropy(from_logits=False)
    
            x_real, z_real = data
    
    
    Severity: Minor
    Found in pyod/models/alad.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 generate_data_clusters has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate_data_clusters(n_train=1000, n_test=500, n_clusters=2,
    Severity: Major
    Found in pyod/utils/data.py - About 1 hr to fix

      Function explain_outlier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def explain_outlier(self, ind, columns=None, cutoffs=None,
                              feature_names=None, file_name=None,
                              file_type=None):  # pragma: no cover
              """Plot dimensional outlier graph for a given data point within
              the dataset.
      Severity: Minor
      Found in pyod/models/ecod.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 elastic_net_subspace_clustering has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def elastic_net_subspace_clustering(self, X, gamma=50.0, gamma_nz=True,
      Severity: Major
      Found in pyod/models/rgraph.py - About 1 hr to fix

        Function fit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def fit(self, X, y=None):
                """Fit detector. y is assumed to be 0 for all training samples.
                Parameters
                ----------
                X : numpy array of shape (n_samples, n_features)
        Severity: Minor
        Found in pyod/models/lunar.py - About 1 hr to fix

          Function active_support_elastic_net has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def active_support_elastic_net(self, X, y, alpha, tau=1.0,
          Severity: Major
          Found in pyod/models/rgraph.py - About 1 hr to fix

            Function generate_data_categorical has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def generate_data_categorical(n_train=1000, n_test=500, n_features=2,
            Severity: Major
            Found in pyod/utils/data.py - About 1 hr to fix

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

                  def get_in_out_channels(i, num_layers, n_features, n_hidden, n_output,
                                          skip_connection):
                      if skip_connection is False:
                          in_channels = n_features if i == 0 else n_hidden[i - 1]
                          out_channels = n_output if i == num_layers else n_hidden[i]
              Severity: Minor
              Found in pyod/models/dif.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_decision_score has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _calculate_decision_score(self, X):
                      """Computes the outlier scores.
                      
                      Parameters
                      ----------
              Severity: Minor
              Found in pyod/models/loci.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 rod_nD has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def rod_nD(X, parallel, gm=None, median=None, data_scaler=None, angles_scalers1=None, angles_scalers2=None):
                  """
                  Find ROD overall scores when Data is higher than 3D:
                    # scale dataset using Robust Scaler
                    # decompose the full space into a combinations of 3D subspaces,
              Severity: Minor
              Found in pyod/models/rod.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 geometric_median has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def geometric_median(x, eps=1e-5):
                  """
                  Find the multivariate geometric L1-median by applying
                  Vardi and Zhang algorithm.
              
              
              Severity: Minor
              Found in pyod/models/rod.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 fit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def fit(self, X, y=None, noise_std=0.1):
                      """Fit detector. y is ignored in unsupervised methods.
                      Parameters
                      ----------
                      X : numpy array of shape (n_samples, n_features)
              Severity: Minor
              Found in pyod/models/alad.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 train_more has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def train_more(self, X, epochs=100, noise_std=0.1):
                      """This function allows the researcher to perform extra training instead of the fixed number determined
                      by the fit() function.
                      """
              
              
              Severity: Minor
              Found in pyod/models/alad.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

              Severity
              Category
              Status
              Source
              Language