Showing 63 of 162 total issues
File recurrent.py
has 557 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import numpy as np
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.
Function backward
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, pre_grad, *args, **kwargs):
# shape
assert pre_grad.shape == self.last_output.shape
nb_batch, input_depth, old_img_h, old_img_w = self.last_input.shape
- 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
File activations.py
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Non-linear activation functions for artificial neurons.
Function backward
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, pre_grad, *args, **kwargs):
self.dW = _zero(self.W.shape)
self.dU = _zero(self.U.shape)
self.db = _zero(self.b.shape)
- 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 forward
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, input, *args, **kwargs):
# shape
self.input_shape = input.shape
pool_h, pool_w = self.pool_size
- 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 backward
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, pre_grad, *args, **kwargs):
new_h, new_w = self.out_shape[-2:]
pool_h, pool_w = self.pool_size
layer_grads = _zero(self.input_shape)
- 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 backward
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, pre_grad, *args, **kwargs):
new_h, new_w = self.out_shape[-2:]
pool_h, pool_w = self.pool_size
length = np.prod(self.pool_size)
- 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 forward
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, input, *args, **kwargs):
# shape
self.input_shape = input.shape
pool_h, pool_w = self.pool_size
new_h, new_w = self.out_shape[-2:]
- 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 get
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get(initialization):
if initialization.__class__.__name__ == 'str':
if initialization in ['zero', 'Zero']:
return Zero()
if initialization in ['one', 'One']:
- 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 22 (exceeds 5 allowed). Consider refactoring. Open
def fit(self, X, Y, max_iter=100, batch_size=64, shuffle=True,
validation_split=0., validation_data=None, file=sys.stdout):
# prepare data
train_X = X.astype(get_dtype()) if np.issubdtype(np.float64, X.dtype) else X
- 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 get
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get(activation):
if activation.__class__.__name__ == 'str':
if activation in ['sigmoid', 'Sigmoid']:
return Sigmoid()
if activation in ['tan', 'tanh', 'Tanh']:
- 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 __init__
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, hidden_size=512, nb_seq=max_sent_size):
print("Load parameters ...")
params = Utils.load_params(hidden_size)
print('Loading is done.')
Function get
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get(objective):
if objective.__class__.__name__ == 'str':
if objective in ['mse', 'MSE']:
return MSE()
if objective in ['mean_squared_error', 'MeanSquaredError']:
- 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 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']:
- 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 backward
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, pre_grad, dcn=None, dhn=None):
"""Backward propagation.
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 forward
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, input, *args, **kwargs):
self.last_input = input
# shape
- 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 train
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def train(self, training_inputs, training_outputs):
self.feed_forward(training_inputs)
# 1. Output neuron deltas
pd_errors_wrt_output_neuron_total_net_input = [0] * len(self.output_layer.neurons)
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def fit(self, X, Y, max_iter=100, batch_size=64, shuffle=True,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, n_out, n_in=None, nb_batch=None, nb_seq=None,