yzhao062/Pyod

View on GitHub

Showing 96 of 249 total issues

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 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 train_step has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def train_step(self, data):
            x_real, z_real = data
    
            x_real = torch.FloatTensor(x_real).to(self.device)
            z_real = torch.FloatTensor(z_real).to(self.device)
    Severity: Minor
    Found in pyod/models/alad.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 _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 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 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 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
          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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, X, y=None, mean=None, std=None, eps=1e-8,
          Severity: Major
          Found in pyod/utils/torch_utility.py - About 1 hr to fix

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

                def __init__(self, n_features, encoding_dim, rff_dim, sigma=1.0,
            Severity: Major
            Found in pyod/models/ae1svm.py - About 1 hr to fix

              Function _x2d has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _x2d(self, X):
                      """Computes the dissimilarity matrix of a given dataset.
                      
                      Parameters
                      ----------
              Severity: Minor
              Found in pyod/models/sos.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(self, n_features, encoding_dim, rff_dim, sigma=1.0,
                               hidden_neurons=(128, 64),
                               dropout_rate=0.2, batch_norm=True, hidden_activation='relu'):
                      super(InnerAE1SVM, self).__init__()
              
              
              Severity: Minor
              Found in pyod/models/ae1svm.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 _set_small_large_clusters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _set_small_large_clusters(self, n_samples):
                      # Sort the index of clusters by the number of samples belonging to it
                      size_clusters = np.bincount(self.cluster_labels_)
              
                      # Sort the order from the largest to the smallest
              Severity: Minor
              Found in pyod/models/cblof.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 __dis has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __dis(self, X):
                      """
                      Internal function to calculate for
                      dissimilarity in a sequence of sets.
                      """
              Severity: Minor
              Found in pyod/models/lmdd.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, n_features, use_ae,
              Severity: Major
              Found in pyod/models/deep_svdd.py - About 50 mins to fix

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

                def get_optimizer_by_name(model, name, lr=1e-3, weight_decay=0,
                Severity: Major
                Found in pyod/utils/torch_utility.py - About 50 mins to fix

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

                  def get_activation_by_name(name, inplace=False,
                  Severity: Major
                  Found in pyod/utils/torch_utility.py - About 50 mins to fix

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

                        def __init__(self, n_features, n_hidden=[500, 100], n_output=20,
                    Severity: Major
                    Found in pyod/models/dif.py - About 50 mins to fix

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

                      def rod_nD(X, parallel, gm=None, median=None, data_scaler=None,
                      Severity: Major
                      Found in pyod/models/rod.py - About 50 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language