paradoxysm/nnrf

View on GitHub

Showing 19 of 19 total issues

Function fit has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring.
Open

    def fit(self, X, Y, *args, weights=None, **kwargs):
        """
        Train the model on the given data and labels.

        Parameters
Severity: Minor
Found in nnrf/utils/_estimator.py - About 4 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

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

    elif set(Y.reshape(-1)) == set([0,1]) or \
            set(Y.reshape(-1)) == set([0.,1.]):
Severity: Major
Found in nnrf/utils/_misc.py and 1 other location - About 2 hrs to fix
nnrf/utils/_misc.py on lines 48..49

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 52.

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

    def scale(self, Y, scale):
        size = scale[1] - scale[0]
        return size * Y + scale[0]
Severity: Major
Found in nnrf/ml/activation.py and 1 other location - About 2 hrs to fix
nnrf/ml/activation.py on lines 285..287

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 52.

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

    if Y.shape[1] == cols and (set(Y.reshape(-1)) == set([0,1]) or \
            set(Y.reshape(-1)) == set([0.,1.])):
Severity: Major
Found in nnrf/utils/_misc.py and 1 other location - About 2 hrs to fix
nnrf/utils/_misc.py on lines 80..81

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 52.

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

    def scale(self, Y, scale):
        size = scale[1] - scale[0]
        return size * Y + scale[0]
Severity: Major
Found in nnrf/ml/activation.py and 1 other location - About 2 hrs to fix
nnrf/ml/activation.py on lines 157..159

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 52.

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

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

    def __init__(self, n=50, d=5, r='sqrt', optimizer='adam', loss='cross-entropy',
Severity: Major
Found in nnrf/_nnrf.py - About 1 hr to fix

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

        def __init__(self, d=5, r='sqrt', loss='cross-entropy',
    Severity: Major
    Found in nnrf/_nndt.py - About 1 hr to fix

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

          def __init__(self, layers=(100,), activation='relu', loss='cross-entropy',
      Severity: Major
      Found in nnrf/_nn.py - About 1 hr to fix

        Function fit has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
        Open

            def fit(self, X, Y, weights=None):
                """
                Train the model on the given data and labels.
        
                Parameters
        Severity: Minor
        Found in nnrf/_nnrf.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 set_params has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
        Open

            def set_params(self, params):
                """
                Set the attributes of the object with the given
                parameters.
        
        
        Severity: Minor
        Found in nnrf/utils/_base.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 9 arguments (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, loss='cross-entropy', max_iter=100, tol=1e-4,
        Severity: Major
        Found in nnrf/utils/_estimator.py - About 1 hr to fix

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

                  super().__init__(loss=loss, max_iter=max_iter, tol=tol,
          Severity: Major
          Found in nnrf/_nnrf.py and 2 other locations - About 55 mins to fix
          nnrf/_nn.py on lines 101..101
          nnrf/_nndt.py on lines 120..120

          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 37.

          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 3 locations. Consider refactoring.
          Open

                  super().__init__(loss=loss, max_iter=max_iter, tol=tol,
          Severity: Major
          Found in nnrf/_nn.py and 2 other locations - About 55 mins to fix
          nnrf/_nndt.py on lines 120..120
          nnrf/_nnrf.py on lines 116..116

          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 37.

          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 3 locations. Consider refactoring.
          Open

                  super().__init__(loss=loss, max_iter=max_iter, tol=tol,
          Severity: Major
          Found in nnrf/_nndt.py and 2 other locations - About 55 mins to fix
          nnrf/_nn.py on lines 101..101
          nnrf/_nnrf.py on lines 116..116

          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 37.

          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

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

              def __init__(self, ensemble, k=100, leaf_size=40,
          Severity: Major
          Found in nnrf/_des_knn.py - About 50 mins to fix

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

                    for k in params.keys():
                        if hasattr(params[k], '__dict__'):
                            params[k] = vars_recurse(params[k])
            Severity: Minor
            Found in nnrf/utils/_base.py and 1 other location - About 50 mins to fix
            nnrf/utils/_base.py on lines 46..50

            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 36.

            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

                        elif isinstance(params[k], np.random.RandomState):
                            params[k] = {'type': np.random.RandomState,
                                            'seed': params[k].get_state()}
                        elif hasattr(params[k], '__dict__'):
                            params[k] = vars_recurse(params[k])
            Severity: Minor
            Found in nnrf/utils/_base.py and 1 other location - About 50 mins to fix
            nnrf/utils/_base.py on lines 18..20

            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 36.

            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

            Function get_activation has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
            Open

            def get_activation(name):
                """
                Lookup table of default activation functions.
            
                Parameters
            Severity: Minor
            Found in nnrf/ml/activation.py - About 35 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 organize has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
            Open

                def organize(self, prepend=[], append=[]):
                    """
                    Organize the BatchDataset according to `order`.
                    In this manner, the order of shuffle, repeat, and
                    batch affect how the data is drawn.
            Severity: Minor
            Found in nnrf/utils/_batch_dataset.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

            Severity
            Category
            Status
            Source
            Language