Skip to content
Snippets Groups Projects
Commit cf0c9fd0 authored by amilashanaka's avatar amilashanaka
Browse files

model change

parent 00d4d179
Branches
No related tags found
No related merge requests found
...@@ -60,10 +60,10 @@ batch_size = 5 ...@@ -60,10 +60,10 @@ batch_size = 5
epochs = 10 epochs = 10
accuracy=0 accuracy=0
execute_time=0 execute_time=0
layer_1_units=100 input_units=100
layer_2_units=50 hidden_layer_1=50
layer_3_units=50 hidden_layer_2=25
dense_units=1 output_units=1
# Scaler # Scaler
scaler = MinMaxScaler() scaler = MinMaxScaler()
...@@ -134,14 +134,11 @@ def input_and_targert(data,feature_length): ...@@ -134,14 +134,11 @@ def input_and_targert(data,feature_length):
x_samples.append(x_sample) x_samples.append(x_sample)
y_samples.append(y_sample) y_samples.append(y_sample)
# Reshape the input as a 3D (Number of samles,length of features,features) # Reshape the input as a 3D (Number of Samples,time steps,features)
#Reshape input
X = np.array(x_samples) X = np.array(x_samples)
X=X.reshape(X.shape[0],X.shape[1],1) X=X.reshape(X.shape[0],X.shape[1],1)
print("\n____Input Data Shape :____") print("\n____Input Data Shape :____")
print(X.shape) print(X.shape)
# Reshape Target # Reshape Target
Y=np.array(y_samples) Y=np.array(y_samples)
Y=Y.reshape(Y.shape[0],1) Y=Y.reshape(Y.shape[0],1)
...@@ -257,23 +254,24 @@ def setup(): ...@@ -257,23 +254,24 @@ def setup():
#Add First LSTM Layer #Add First LSTM Layer
model.add(LSTM(units = input_units, activation = 'relu', input_shape = (time_steps, features), return_sequences=True))
model.add(LSTM(units = layer_1_units, activation = 'relu', input_shape = (time_steps, features), return_sequences=True))
# Adding the Second hidden layer and the LSTM layer # Adding the Second hidden layer and the LSTM layer
model.add(LSTM(units = hidden_layer_1, activation = 'relu', input_shape = (time_steps, features), return_sequences=True))
model.add(LSTM(units = layer_2_units, activation = 'relu', input_shape = (time_steps, features), return_sequences=True))
# Adding the Third hidden layer and the LSTM layer # Adding the Third hidden layer and the LSTM layer
model.add(LSTM(units = layer_3_units, activation = 'relu', return_sequences=False )) model.add(LSTM(units = hidden_layer_2, activation = 'relu', return_sequences=False ))
# Adding the output layer # Adding the output layer
model.add(Dense(units = dense_units)) model.add(Dense(units = output_units))
# Compiling model # Compiling model
model.compile(optimizer = 'adam', loss = 'mean_squared_error') model.compile(optimizer = 'adam', loss = 'mean_squared_error')
print(model.input)
print(model.output)
print(model.summary())
# Measuring the time taken by the model to train # Measuring the time taken by the model to train
start_time=time.time() start_time=time.time()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment