lucasmiranda42/deepof

View on GitHub
deepof/models.py

Summary

Maintainability
F
1 wk
Test Coverage

File models.py has 1637 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""deep autoencoder models for unsupervised pose detection.

- VQ-VAE: a variational autoencoder with a vector quantization latent-space (https://arxiv.org/abs/1711.00937).
- VaDE: a variational autoencoder with a Gaussian mixture latent-space.
- Contrastive: an embedding model consisting of a single encoder, trained using a contrastive loss.
Severity: Major
Found in deepof/models.py - About 4 days to fix

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

        def __init__(
    Severity: Major
    Found in deepof/models.py - About 2 hrs to fix

      Function get_TCN_encoder has 14 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def get_TCN_encoder(
      Severity: Major
      Found in deepof/models.py - About 1 hr to fix

        Function get_vade has 14 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def get_vade(
        Severity: Major
        Found in deepof/models.py - About 1 hr to fix

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

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

            Function call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def call(self, inputs, training=False):  # pragma: no cover
                    """Compute the output of the layer."""
                    z_gauss_mean = self.z_gauss_mean(inputs)
                    z_gauss_var = self.z_gauss_var(inputs)
            
            
            Severity: Minor
            Found in deepof/models.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 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

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

                Function get_TCN_decoder has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def get_TCN_decoder(
                Severity: Major
                Found in deepof/models.py - About 1 hr to fix

                  Function get_vqvae has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def get_vqvae(
                  Severity: Major
                  Found in deepof/models.py - About 1 hr to fix

                    Function get_transformer_encoder has 10 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def get_transformer_encoder(
                    Severity: Major
                    Found in deepof/models.py - About 1 hr to fix

                      Function call has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def call(self, inputs, training=False):  # pragma: no cover
                              """Compute the output of the layer."""
                              z_gauss_mean = self.z_gauss_mean(inputs)
                              z_gauss_var = self.z_gauss_var(inputs)
                      
                      
                      Severity: Minor
                      Found in deepof/models.py - About 1 hr to fix

                        Function __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def __init__(
                                self,
                                input_shape: tuple,
                                edge_feature_shape: tuple,
                                adjacency_matrix: np.ndarray = None,
                        Severity: Minor
                        Found in deepof/models.py - About 1 hr to fix

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

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

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

                            def get_recurrent_encoder(
                            Severity: Major
                            Found in deepof/models.py - About 1 hr to fix

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

                                  def pretrain(
                              Severity: Major
                              Found in deepof/models.py - About 50 mins to fix

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

                                def get_transformer_decoder(
                                Severity: Minor
                                Found in deepof/models.py - About 45 mins to fix

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

                                      def __init__(
                                  Severity: Minor
                                  Found in deepof/models.py - About 35 mins to fix

                                    Function test_step has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def test_step(self, data):  # pragma: no cover
                                            """Performs a test step."""
                                            # Unpack data, repacking labels into a generator
                                            x, a, y = data
                                            if not isinstance(y, tuple):
                                    Severity: Minor
                                    Found in deepof/models.py - About 25 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_step has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def train_step(self, data):  # pragma: no cover
                                            """Perform a training step."""
                                            # Unpack data, repacking labels into a generator
                                            x, a, y = data
                                            if not isinstance(y, tuple):
                                    Severity: Minor
                                    Found in deepof/models.py - About 25 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

                                    There are no issues that match your filters.

                                    Category
                                    Status