oujago/NumpyDL

View on GitHub
npdl/optimizers.py

Summary

Maintainability
F
6 days
Test Coverage

File optimizers.py has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Functions to generate Theano update dictionaries for training.

The update functions implement different methods to control the learning
rate for use with stochastic gradient descent.
Severity: Minor
Found in npdl/optimizers.py - About 4 hrs to fix

    Function get has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def get(optimizer):
        if optimizer.__class__.__name__ == 'str':
            if optimizer in ['sgd', 'SGD']:
                return SGD()
            if optimizer in ['momentum', 'Momentum']:
    Severity: Minor
    Found in npdl/optimizers.py - About 2 hrs 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 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, beta1=0.9, beta2=0.999, epsilon=1e-8, *args, **kwargs):
    Severity: Minor
    Found in npdl/optimizers.py - About 35 mins to fix

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

          def __init__(self, lr=0.001, clip=-1, decay=0., lr_min=0., lr_max=np.inf):
      Severity: Minor
      Found in npdl/optimizers.py - About 35 mins to fix

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

            def __init__(self, beta1=0.9, beta2=0.999, epsilon=1e-8, *args, **kwargs):
        Severity: Minor
        Found in npdl/optimizers.py - About 35 mins to fix

          Avoid too many return statements within this function.
          Open

                  return copy.deepcopy(optimizer)
          Severity: Major
          Found in npdl/optimizers.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return Adamax()
            Severity: Major
            Found in npdl/optimizers.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return Adadelta()
              Severity: Major
              Found in npdl/optimizers.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return RMSprop()
                Severity: Major
                Found in npdl/optimizers.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return Adam()
                  Severity: Major
                  Found in npdl/optimizers.py - About 30 mins to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    def get(optimizer):
                        if optimizer.__class__.__name__ == 'str':
                            if optimizer in ['sgd', 'SGD']:
                                return SGD()
                            if optimizer in ['momentum', 'Momentum']:
                    Severity: Major
                    Found in npdl/optimizers.py and 1 other location - About 1 day to fix
                    npdl/objectives.py on lines 299..323

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 214.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        def __init__(self, beta1=0.9, beta2=0.999, epsilon=1e-8, *args, **kwargs):
                            super(Adamax, self).__init__(*args, **kwargs)
                    
                            self.beta1 = beta1
                            self.beta2 = beta2
                    Severity: Major
                    Found in npdl/optimizers.py and 1 other location - About 3 hrs to fix
                    npdl/optimizers.py on lines 399..407

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 64.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        def __init__(self, beta1=0.9, beta2=0.999, epsilon=1e-8, *args, **kwargs):
                            super(Adam, self).__init__(*args, **kwargs)
                    
                            self.beta1 = beta1
                            self.beta2 = beta2
                    Severity: Major
                    Found in npdl/optimizers.py and 1 other location - About 3 hrs to fix
                    npdl/optimizers.py on lines 451..459

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 64.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                d = self.rho * d + (1 - self.rho) * np.power(update, 2)
                    Severity: Major
                    Found in npdl/optimizers.py and 3 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 295..295
                    npdl/optimizers.py on lines 363..363
                    npdl/optimizers.py on lines 422..422

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                c = self.rho * c + (1 - self.rho) * np.power(g, 2)
                    Severity: Major
                    Found in npdl/optimizers.py and 3 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 295..295
                    npdl/optimizers.py on lines 366..366
                    npdl/optimizers.py on lines 422..422

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                v = self.beta2 * v + (1 - self.beta2) * np.power(g, 2)
                    Severity: Major
                    Found in npdl/optimizers.py and 3 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 295..295
                    npdl/optimizers.py on lines 363..363
                    npdl/optimizers.py on lines 366..366

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                c = self.rho * c + (1 - self.rho) * np.power(g, 2)
                    Severity: Major
                    Found in npdl/optimizers.py and 3 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 363..363
                    npdl/optimizers.py on lines 366..366
                    npdl/optimizers.py on lines 422..422

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 40.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                        def __init__(self, momentum=0.9, *args, **kwargs):
                            super(NesterovMomentum, self).__init__(*args, **kwargs)
                    
                            self.momentum = momentum
                    
                    Severity: Major
                    Found in npdl/optimizers.py and 2 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 123..128
                    npdl/optimizers.py on lines 225..230

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                        def __init__(self, momentum=0.9, *args, **kwargs):
                            super(Momentum, self).__init__(*args, **kwargs)
                    
                            self.momentum = momentum
                    
                    Severity: Major
                    Found in npdl/optimizers.py and 2 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 171..176
                    npdl/optimizers.py on lines 225..230

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                        def __init__(self, epsilon=1e-6, *args, **kwargs):
                            super(Adagrad, self).__init__(*args, **kwargs)
                    
                            self.epsilon = epsilon
                    
                    Severity: Major
                    Found in npdl/optimizers.py and 2 other locations - About 1 hr to fix
                    npdl/optimizers.py on lines 123..128
                    npdl/optimizers.py on lines 171..176

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 39.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.ms is None:
                                self.ms = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.cache is None:
                                self.cache = [_zero(g.shape) for g in grads]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.ms is None:
                                self.ms = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.velocity is None:
                                self.velocity = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.cache is None:
                                self.cache = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.vs is None:
                                self.vs = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                m = self.beta1 * m + (1 - self.beta1) * g
                    Severity: Minor
                    Found in npdl/optimizers.py and 1 other location - About 35 mins to fix
                    npdl/optimizers.py on lines 472..472

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                m = self.beta1 * m + (1 - self.beta1) * g
                    Severity: Minor
                    Found in npdl/optimizers.py and 1 other location - About 35 mins to fix
                    npdl/optimizers.py on lines 421..421

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.velocity is None:
                                self.velocity = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.vs is None:
                                self.vs = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.cache is None:
                                self.cache = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 358..359
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 10 locations. Consider refactoring.
                    Open

                            if self.delta is None:
                                self.delta = [_zero(p.shape) for p in params]
                    Severity: Major
                    Found in npdl/optimizers.py and 9 other locations - About 35 mins to fix
                    npdl/optimizers.py on lines 132..133
                    npdl/optimizers.py on lines 180..181
                    npdl/optimizers.py on lines 234..235
                    npdl/optimizers.py on lines 290..291
                    npdl/optimizers.py on lines 356..357
                    npdl/optimizers.py on lines 414..415
                    npdl/optimizers.py on lines 416..417
                    npdl/optimizers.py on lines 465..466
                    npdl/optimizers.py on lines 467..468

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    There are no issues that match your filters.

                    Category
                    Status