From d7e613fc78b76f95c326f15cb89109d6b0fb9e67 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 27 Feb 2021 15:00:28 +0100 Subject: [PATCH] Use ==/!= to compare constant literals (str, bytes, int, float, tuple) --- prediction_techniques/neural_networks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prediction_techniques/neural_networks.py b/prediction_techniques/neural_networks.py index ff1c24f6fa7..1929843ad23 100644 --- a/prediction_techniques/neural_networks.py +++ b/prediction_techniques/neural_networks.py @@ -27,7 +27,7 @@ def build_neural_network_model(Recurrent_Neural_Network, n_inputs, n_days): for idx_layer, d_layer in enumerate(Recurrent_Neural_Network): # Recurrent Neural Network - if str(*d_layer) is 'SimpleRNN': + if str(*d_layer) == 'SimpleRNN': # Is this the input layer? If so, define input_shape if idx_layer == 0: model.add(SimpleRNN(**d_layer['SimpleRNN'], input_shape=(n_inputs, 1))) @@ -38,7 +38,7 @@ def build_neural_network_model(Recurrent_Neural_Network, n_inputs, n_days): model.add(SimpleRNN(**d_layer['SimpleRNN'])) # Long-Short Term-Memory - elif str(*d_layer) is 'LSTM': + elif str(*d_layer) == 'LSTM': # Is this the input layer? If so, define input_shape if idx_layer == 0: model.add(LSTM(**d_layer['LSTM'], input_shape=(n_inputs, 1))) @@ -49,7 +49,7 @@ def build_neural_network_model(Recurrent_Neural_Network, n_inputs, n_days): model.add(LSTM(**d_layer['LSTM'])) # Dense (Simple Neuron) - elif str(*d_layer) is 'Dense': + elif str(*d_layer) == 'Dense': # Is this the input layer? If so, define input_shape if idx_layer == 0: model.add(Dense(**d_layer['Dense'], input_dim=n_inputs))