File mdla.py
has 1246 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" Multivariate dictionary learning"""
# Author: Sylvain Chevallier
# License: GPL v3
import itertools
Function multivariate_dict_learning
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def multivariate_dict_learning(
X,
n_kernels,
n_nonzero_coefs=1,
max_iter=100,
- Read upRead up
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 _multivariate_OMP
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def _multivariate_OMP(signal, dictionary, n_nonzero_coefs=None, verbose=False):
"""Sparse coding multivariate signal with OMP
Returns residual and a decomposition array (n_nonzero_coefs, 3),
each line indicating (amplitude, offset, kernel).
- Read upRead up
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 multivariate_dict_learning_online
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def multivariate_dict_learning_online(
X,
n_kernels=2,
n_nonzero_coefs=1,
n_iter=100,
- Read upRead up
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 _compute_gradient
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _compute_gradient(
dictionary,
decomposition,
residual,
learning_rate=None,
- Read upRead up
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 multivariate_dict_learning_online
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def multivariate_dict_learning_online(
Function multivariate_dict_learning
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def multivariate_dict_learning(
Function __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _multivariate_OMP
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _multivariate_OMP(signal, dictionary, n_nonzero_coefs=None, verbose=False):
"""Sparse coding multivariate signal with OMP
Returns residual and a decomposition array (n_nonzero_coefs, 3),
each line indicating (amplitude, offset, kernel).
Function multivariate_sparse_encode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def multivariate_sparse_encode(
X, dictionary, n_nonzero_coefs=None, n_jobs=1, verbose=False
):
"""Sparse coding
- Read upRead up
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 partial_fit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def partial_fit(self, X, y=None, iter_offset=None):
"""Updates the model using the data in X as a mini-batch.
Parameters
----------
- Read upRead up
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 _update_dict
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _update_dict(
Function _update_dict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _update_dict(
dictionary,
decomposition,
residual,
learning_rate=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fit(self, X, y=None):
"""Fit the model from data in X.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fit(self, X, y=None):
"""Fit the model from data in X.
Parameters
----------
- Read upRead up
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 _compute_gradient
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _compute_gradient(
Function multivariate_sparse_encode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def multivariate_sparse_encode(
Function array3d
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def array3d(X, dtype=None, order=None, copy=False, force_all_finite=True):
Function _set_mdla_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _set_mdla_params(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(