yzhao062/Pyod

View on GitHub

Showing 96 of 249 total issues

File devnet.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""Deep anomaly detection with deviation networks
Part of the codes are adapted from
https://github.com/GuansongPang/deviation-network
Severity: Minor
Found in pyod/models/devnet.py - About 2 hrs to fix

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

        def __init__(self, activation_hidden='tanh', dropout_rate=0.2,
    Severity: Major
    Found in pyod/models/anogan.py - About 2 hrs to fix

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

          def __init__(self, n_features, c=None, use_ae=False, hidden_neurons=None,
      Severity: Major
      Found in pyod/models/deep_svdd.py - About 2 hrs to fix

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

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

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

              def __init__(self, hidden_neurons=None, hidden_activation='relu',
          Severity: Major
          Found in pyod/models/ae1svm.py - About 1 hr to fix

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

                def _build_model(self):
                    def get_activation(name):
                        if name == 'tanh':
                            return nn.Tanh()
                        elif name == 'sigmoid':
            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 active_support_elastic_net has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def active_support_elastic_net(self, X, y, alpha, tau=1.0,
                                               algorithm='lasso_lars', support_init='L2',
                                               support_size=100, maxiter=40,
                                               maxiter_lasso=1000):
                    """
            Severity: Minor
            Found in pyod/models/rgraph.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 14 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, in_features, out_features,
            Severity: Major
            Found in pyod/utils/torch_utility.py - About 1 hr to fix

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

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

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

                    def __init__(self, model_type="WEIGHT", n_neighbours=5,
                Severity: Major
                Found in pyod/models/lunar.py - About 1 hr to fix

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

                      def __init__(self, contamination=0.1, preprocessing=True,
                  Severity: Major
                  Found in pyod/models/so_gaal_new.py - About 1 hr to fix

                    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 _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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

                      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/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 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 __getitem__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __getitem__(self, idx):
                                  if torch.is_tensor(idx):
                                      idx = idx.tolist()
                                  sample = self.X[idx, :]
                          
                          
                          Severity: Minor
                          Found in pyod/utils/torch_utility.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 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
                            Severity
                            Category
                            Status
                            Source
                            Language