Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dsa2-gunasinha
CSCT
Commits
cf0c9fd0
Commit
cf0c9fd0
authored
2 years ago
by
amilashanaka
Browse files
Options
Downloads
Patches
Plain Diff
model change
parent
00d4d179
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/run.py
+14
-16
14 additions, 16 deletions
api/run.py
with
14 additions
and
16 deletions
api/run.py
+
14
−
16
View file @
cf0c9fd0
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment