yzhao062/Pyod

View on GitHub

Showing 96 of 249 total issues

Function fit has a Cognitive Complexity of 8 (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 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 check_consistent_shape has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def check_consistent_shape(X_train, y_train, X_test, y_test, y_train_pred,
Severity: Minor
Found in pyod/utils/data.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            with torch.no_grad():
                                fake_data = names['sub_generator' + str(i)](
                                    names['noise' + str(i)])
                                fake_outputs = self.discriminator(fake_data)
                                generator_loss = criterion(fake_outputs,
    Severity: Major
    Found in pyod/models/mo_gaal.py - About 45 mins to fix

      Function fit has a Cognitive Complexity of 8 (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/loda.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, in_channels, out_channels,
      Severity: Minor
      Found in pyod/models/dif.py - About 45 mins to fix

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

            def decision_function(self, X):
                """Predict raw anomaly score of X using the fitted detector.
        
                The anomaly score of an input sample is computed based on different
                detector algorithms. For consistency, outliers are assigned with
        Severity: Minor
        Found in pyod/models/loda.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, latent_dim_G, n_features, G_layers, dropout_rate,
        Severity: Minor
        Found in pyod/models/anogan.py - About 45 mins to fix

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

              def __init__(
          Severity: Minor
          Found in pyod/models/kde.py - About 45 mins to fix

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

            def _calculate_outlier_scores(X, bin_edges, hist, n_bins, alpha,
            Severity: Minor
            Found in pyod/models/hbos.py - About 45 mins to fix

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

                  def explain_outlier(self, ind, columns=None, cutoffs=None,
              Severity: Minor
              Found in pyod/models/ecod.py - About 45 mins to fix

                Function fit has a Cognitive Complexity of 8 (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/sampling.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 detector. y is ignored in unsupervised methods.
                
                        Parameters
                        ----------
                Severity: Minor
                Found in pyod/models/kpca.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 vae_loss has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def vae_loss(x, x_recon, z_mu, z_logvar, beta=1.0, capacity=0.0):
                Severity: Minor
                Found in pyod/models/vae.py - About 45 mins to fix

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

                  def _calculate_outlier_scores_auto(X, bin_edges, hist, alpha,
                  Severity: Minor
                  Found in pyod/models/hbos.py - About 35 mins to fix

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

                        def __init__(self,
                    Severity: Minor
                    Found in pyod/models/sampling.py - About 35 mins to fix

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

                      def process_sub(subspace, gm, median, scaler1, scaler2):
                      Severity: Minor
                      Found in pyod/models/rod.py - About 35 mins to fix

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

                        def train_and_test(model, train_loader, test_loader, epochs, device):
                        Severity: Minor
                        Found in pyod/models/devnet.py - About 35 mins to fix

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

                          def rod_3D(x, gm=None, median=None, scaler1=None, scaler2=None):
                          Severity: Minor
                          Found in pyod/models/rod.py - About 35 mins to fix

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

                                def get_in_out_channels(i, num_layers, n_features, n_hidden, n_output,
                            Severity: Minor
                            Found in pyod/models/dif.py - About 35 mins to fix

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

                              def input_batch_generation_sup_sparse(x_train, outlier_indices, inlier_indices,
                              Severity: Minor
                              Found in pyod/models/devnet.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language