Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
O.V.B Sewmina
2022-020
Commits
cd4ab252
Commit
cd4ab252
authored
Oct 08, 2022
by
W.P.S.M wickramage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TrainPartAdded
parent
937fbe16
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
902 additions
and
3 deletions
+902
-3
.vscode/settings.json
.vscode/settings.json
+5
-0
TravelTimePrediction/BusTravelData.csv
TravelTimePrediction/BusTravelData.csv
+0
-0
TravelTimePrediction/TrainData/TrainData.csv
TravelTimePrediction/TrainData/TrainData.csv
+151
-0
TravelTimePrediction/TrainData/TrainData.xlsx
TravelTimePrediction/TrainData/TrainData.xlsx
+0
-0
TravelTimePrediction/TrainData/TrainDataSet.txt
TravelTimePrediction/TrainData/TrainDataSet.txt
+6
-0
TravelTimePrediction/TrainData/TrainTimePrediction.ipynb
TravelTimePrediction/TrainData/TrainTimePrediction.ipynb
+609
-0
TravelTimePrediction/TrainData/TrainTimePrediction.py
TravelTimePrediction/TrainData/TrainTimePrediction.py
+114
-0
TravelTimePrediction/TrainData/__pycache__/TrainTimePrediction.cpython-310.pyc
...TrainData/__pycache__/TrainTimePrediction.cpython-310.pyc
+0
-0
TravelTimePrediction/TravelTimePrediction.ipynb
TravelTimePrediction/TravelTimePrediction.ipynb
+1
-1
TravelTimePrediction/TravelTimePredictionNN.py
TravelTimePrediction/TravelTimePredictionNN.py
+16
-2
TravelTimePrediction/__pycache__/.gitkeep
TravelTimePrediction/__pycache__/.gitkeep
+0
-0
TravelTimePrediction/__pycache__/testingWeather.cpython-310.pyc
...TimePrediction/__pycache__/testingWeather.cpython-310.pyc
+0
-0
TravelTimePrediction/testingWeather.py
TravelTimePrediction/testingWeather.py
+0
-0
No files found.
.vscode/settings.json
0 → 100644
View file @
cd4ab252
{
"python.analysis.extraPaths"
:
[
"./TravelTimePrediction/TrainData"
]
}
\ No newline at end of file
BusTravelData.csv
→
TravelTimePrediction/
BusTravelData.csv
View file @
cd4ab252
File moved
TravelTimePrediction/TrainData/TrainData.csv
0 → 100644
View file @
cd4ab252
Dipature,Arrival,Time
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
Dehiwala,Fort ,25min
Dehiwala,wellawatte,5min
Dehiwala,bambalapitiya,9min
Dehiwala,kollupitiya,13min
Dehiwala,kompannavidiya,16min
wellawatte,bambalapitiya,4min
wellawatte,kollupitiya,8min
wellawatte,kompannavidiya,11min
wellawatte,Fort ,13min
bambalapitiya,kollupitiya,4min
bambalapitiya,kompannavidiya,7min
bambalapitiya,Fort ,9min
kollupitiya,kompannavidiya,3min
kollupitiya,Fort ,5min
kompannavidiya,Fort ,3min
TravelTimePrediction/TrainData/TrainData.xlsx
0 → 100644
View file @
cd4ab252
File added
TravelTimePrediction/TrainData/TrainDataSet.txt
0 → 100644
View file @
cd4ab252
Dehiwala 1
wellawatte 2
bambalapitiya 3
kollupitiya 4
kompannavidiya 5
Fort 6
TravelTimePrediction/TrainData/TrainTimePrediction.ipynb
0 → 100644
View file @
cd4ab252
This diff is collapsed.
Click to expand it.
TravelTimePrediction/TrainData/TrainTimePrediction.py
0 → 100644
View file @
cd4ab252
# %%
import
pandas
as
pd
# %%
data
=
pd
.
read_csv
(
'TravelTimePrediction
\
TrainData
\
TrainData.csv'
)
# %%
# %%
# %%
# %%
data
[
'Dipature'
]
.
map
({
'Dehiwala'
:
1
,
'wellawatte'
:
2
,
'bambalapitiya'
:
3
,
'kollupitiya'
:
4
,
'kompannavidiya'
:
5
})
# %%
data
[
'Dipature'
]
=
data
[
'Dipature'
]
.
map
({
'Dehiwala'
:
1
,
'wellawatte'
:
2
,
'bambalapitiya'
:
3
,
'kollupitiya'
:
4
,
'kompannavidiya'
:
5
})
# %%
# %%
data
[
'Arrival'
]
.
map
({
'Fort '
:
6
,
'wellawatte'
:
2
,
'bambalapitiya'
:
3
,
'kollupitiya'
:
4
,
'kompannavidiya'
:
5
})
# %%
data
[
'Arrival'
]
=
data
[
'Arrival'
]
.
map
({
'Fort '
:
6
,
'wellawatte'
:
2
,
'bambalapitiya'
:
3
,
'kollupitiya'
:
4
,
'kompannavidiya'
:
5
})
# %%
# %%
X
=
data
.
drop
([
'Time'
],
axis
=
1
)
# %%
y
=
data
[
'Time'
]
# %%
from
sklearn.model_selection
import
train_test_split
# %%
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
test_size
=
0.2
,
random_state
=
42
)
# %%
from
sklearn.neural_network
import
MLPClassifier
# %%
NN
=
MLPClassifier
()
NN
.
fit
(
X_train
,
y_train
)
# %%
y_pred1
=
NN
.
predict
(
X_test
)
# %%
df1
=
pd
.
DataFrame
({
'Actual'
:
y_test
,
'NN Results'
:
y_pred1
})
# %%
data
=
{
'Dipature'
:
1
,
'Arrival'
:
2
,
}
df
=
pd
.
DataFrame
(
data
,
index
=
[
0
])
# %%
predit
=
NN
.
predict
(
df
)
# %%
def
GetTrainPrediction
(
Dipature
,
Arrival
):
data
=
{
'Dipature'
:
Dipature
,
'Arrival'
:
Arrival
,
}
df
=
pd
.
DataFrame
(
data
,
index
=
[
0
])
predit
=
NN
.
predict
(
df
)
print
(
'Train Travel Time Prediction :- '
,
*
predit
,
' '
)
# %%
def
GetDipatureCode
(
data
):
if
(
'Dehiwala'
==
data
):
return
1
elif
(
'wellawatte'
==
data
):
return
2
elif
(
'bambalapitiya'
==
data
):
return
3
elif
(
'kollupitiya'
==
data
):
return
4
elif
(
'kompannavidiya'
==
data
):
return
5
# %%
def
GetArrivalCode
(
data
):
if
(
'Fort'
==
data
):
return
6
elif
(
'wellawatte'
==
data
):
return
2
elif
(
'bambalapitiya'
==
data
):
return
3
elif
(
'kollupitiya'
==
data
):
return
4
elif
(
'kompannavidiya'
==
data
):
return
5
# %%
def
GetPrediction
(
Dvalue
,
Avalue
):
Dipature
=
GetDipatureCode
(
Dvalue
)
Arrival
=
GetArrivalCode
(
Avalue
)
GetTrainPrediction
(
Dipature
,
Arrival
)
GetPrediction
(
'Dehiwala'
,
'Fort'
)
\ No newline at end of file
TravelTimePrediction/TrainData/__pycache__/TrainTimePrediction.cpython-310.pyc
0 → 100644
View file @
cd4ab252
File added
TravelTimePrediction.ipynb
→
TravelTimePrediction
/TravelTimePrediction
.ipynb
View file @
cd4ab252
...
...
@@ -1668,7 +1668,7 @@
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "
26de051ba29f2982a8de78e945f0abaf191376122a1563185a90213a26c5da77
"
"hash": "
5cf8c3d3e58a91b903f819a9c98dd2220f70e367ec47969cb612bf546ce9e823
"
}
}
},
...
...
TravelTimePredictionNN.py
→
TravelTimePrediction
/TravelTimePrediction
NN.py
View file @
cd4ab252
...
...
@@ -2,7 +2,7 @@
import
pandas
as
pd
# %%
data
=
pd
.
read_csv
(
'BusTravelData.csv'
)
data
=
pd
.
read_csv
(
'
TravelTimePrediction
\
BusTravelData.csv'
)
# %%
...
...
@@ -180,6 +180,8 @@ def GetDateCode(date):
import
testingWeather
city
=
"malabe"
city
=
city
+
" weather"
...
...
@@ -187,7 +189,7 @@ time= 6 #this time come from semins data/member of route planning
day
=
'Friday'
#date come from UI
date
=
GetDateCode
(
day
)
special
=
0
# Special Day or Not 1/0
Congestion
=
8
# This is
depend on the depature time---- heavy traffic =9 / No Traffic = 0
Congestion
=
8
# This is
come from TomTOm API / APK app
drivingspeedAVG
=
40
#this is come from GPS data
stops
=
14
#total Bus stops/holts between the travel --- data come from the Seminas data/member of route planning
weather
=
testingWeather
.
weather
(
city
)
#Get weather in travel area
...
...
@@ -198,5 +200,17 @@ GetPrediction(time,date,special,Congestion,drivingspeedAVG,stops,weather,Distanc
# Get Train Data
# import sys
# adding Folder_2/subfolder to the system path
# sys.path.insert(0, 'TravelTimePrediction\TrainData')
# importing the hello
# from TrainTimePrediction import GetPrediction
# GetPrediction('Dehiwala','Fort')
__pycache__/.gitkeep
→
TravelTimePrediction/
__pycache__/.gitkeep
View file @
cd4ab252
File moved
__pycache__/testingWeather.cpython-310.pyc
→
TravelTimePrediction/
__pycache__/testingWeather.cpython-310.pyc
View file @
cd4ab252
No preview for this file type
testingWeather.py
→
TravelTimePrediction/
testingWeather.py
View file @
cd4ab252
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment