Spaces:
Sleeping
Sleeping
Update utils/config.py
Browse filesRemoved RandomForest from All Models
- utils/config.py +101 -101
utils/config.py
CHANGED
@@ -1,101 +1,101 @@
|
|
1 |
-
from dotenv import dotenv_values
|
2 |
-
from pathlib import Path
|
3 |
-
from ipyleaflet import basemaps
|
4 |
-
|
5 |
-
from shiny.express import ui
|
6 |
-
|
7 |
-
|
8 |
-
# Paths
|
9 |
-
# ENV when using standalone shiny server, shiny for python runs from the root of the project
|
10 |
-
ENV_PATH = Path("env/online.env")
|
11 |
-
|
12 |
-
DATA = Path(__file__).parent.parent / "data/"
|
13 |
-
TEST_FILE = DATA / "Test.csv"
|
14 |
-
TRAIN_FILE = DATA / "Train.csv"
|
15 |
-
WEATHER_FILE = DATA / "Weather.csv"
|
16 |
-
HISTORY = DATA / "history/"
|
17 |
-
HISTORY_FILE = HISTORY / "history.csv"
|
18 |
-
|
19 |
-
|
20 |
-
# Models
|
21 |
-
ALL_MODELS = [
|
22 |
-
"AdaBoostRegressor",
|
23 |
-
"DecisionTreeRegressor",
|
24 |
-
"GradientBoostingRegressor",
|
25 |
-
"HistGradientBoostingRegressor",
|
26 |
-
"LinearRegression",
|
27 |
-
"RandomForestRegressor",
|
28 |
-
"XGBRegressor",
|
29 |
-
]
|
30 |
-
|
31 |
-
BEST_MODELS = ["RandomForestRegressor", "XGBRegressor"]
|
32 |
-
|
33 |
-
|
34 |
-
# Urls
|
35 |
-
TEST_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Test.csv"
|
36 |
-
TRAIN_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Train.csv"
|
37 |
-
WEATHER_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Weather.csv"
|
38 |
-
|
39 |
-
|
40 |
-
# Load environment variables from .env file into a dictionary
|
41 |
-
environment_variables = dotenv_values(ENV_PATH)
|
42 |
-
|
43 |
-
|
44 |
-
# Get the OpenRouteService API key
|
45 |
-
# https://openrouteservice.org/dev/#/home
|
46 |
-
ors_api_key = environment_variables.get("ORS_API_TOKEN")
|
47 |
-
|
48 |
-
# https://maps.app.goo.gl/Fx5rdPs1KeA6jCeB8
|
49 |
-
KENYA_LAT = 0.15456
|
50 |
-
KENYA_LON = 37.908383
|
51 |
-
|
52 |
-
|
53 |
-
BASEMAPS = {
|
54 |
-
"DarkMatter": basemaps.CartoDB.DarkMatter,
|
55 |
-
"Mapnik": basemaps.OpenStreetMap.Mapnik,
|
56 |
-
"NatGeoWorldMap": basemaps.Esri.NatGeoWorldMap,
|
57 |
-
"WorldImagery": basemaps.Esri.WorldImagery,
|
58 |
-
}
|
59 |
-
|
60 |
-
# Yassir
|
61 |
-
BRANDCOLORS = {
|
62 |
-
"red": "#FB2576",
|
63 |
-
"purple-light": "#6316DB",
|
64 |
-
"purple-dark": "#08031A",
|
65 |
-
}
|
66 |
-
|
67 |
-
BRANDTHEMES = {
|
68 |
-
"red": ui.value_box_theme(bg=BRANDCOLORS['red'], fg='white'),
|
69 |
-
"purple-light": ui.value_box_theme(bg=BRANDCOLORS['purple-light'], fg='white'),
|
70 |
-
"purple-dark": ui.value_box_theme(bg=BRANDCOLORS['purple-dark'], fg='white'),
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
# Nairobi, https://maps.app.goo.gl/oPbLBYHuicjrC22J9
|
75 |
-
# National Museum of Kenya, https://maps.app.goo.gl/zbmUpe71admABU9i9
|
76 |
-
# Closest location
|
77 |
-
LOCATIONS = {
|
78 |
-
"Nairobi": {"latitude": -1.3032036, "longitude": 36.6825914},
|
79 |
-
"National Museum of Kenya": {"latitude": -1.2739575, "longitude": 36.8118501},
|
80 |
-
"Mombasa": {"latitude": -1.3293123, "longitude": 36.8717466},
|
81 |
-
}
|
82 |
-
|
83 |
-
|
84 |
-
HOURS = [f"{i:02}" for i in range(0, 24)]
|
85 |
-
|
86 |
-
MINUTES = [f"{i:02}" for i in range(0, 12)]
|
87 |
-
|
88 |
-
SECONDS = [f"{i:02}" for i in range(0, 60)]
|
89 |
-
|
90 |
-
|
91 |
-
ONE_MINUTE_SEC = 60
|
92 |
-
|
93 |
-
ONE_HOUR_SEC = ONE_MINUTE_SEC * 60
|
94 |
-
|
95 |
-
ONE_DAY_SEC = ONE_HOUR_SEC * 24
|
96 |
-
|
97 |
-
ONE_WEEK_SEC = ONE_DAY_SEC * 7
|
98 |
-
|
99 |
-
|
100 |
-
# Default trip distance
|
101 |
-
TRIP_DISTANCE = 30275.7
|
|
|
1 |
+
from dotenv import dotenv_values
|
2 |
+
from pathlib import Path
|
3 |
+
from ipyleaflet import basemaps
|
4 |
+
|
5 |
+
from shiny.express import ui
|
6 |
+
|
7 |
+
|
8 |
+
# Paths
|
9 |
+
# ENV when using standalone shiny server, shiny for python runs from the root of the project
|
10 |
+
ENV_PATH = Path("env/online.env")
|
11 |
+
|
12 |
+
DATA = Path(__file__).parent.parent / "data/"
|
13 |
+
TEST_FILE = DATA / "Test.csv"
|
14 |
+
TRAIN_FILE = DATA / "Train.csv"
|
15 |
+
WEATHER_FILE = DATA / "Weather.csv"
|
16 |
+
HISTORY = DATA / "history/"
|
17 |
+
HISTORY_FILE = HISTORY / "history.csv"
|
18 |
+
|
19 |
+
|
20 |
+
# Models
|
21 |
+
ALL_MODELS = [
|
22 |
+
"AdaBoostRegressor",
|
23 |
+
"DecisionTreeRegressor",
|
24 |
+
"GradientBoostingRegressor",
|
25 |
+
"HistGradientBoostingRegressor",
|
26 |
+
"LinearRegression",
|
27 |
+
# "RandomForestRegressor",
|
28 |
+
"XGBRegressor",
|
29 |
+
]
|
30 |
+
|
31 |
+
BEST_MODELS = ["RandomForestRegressor", "XGBRegressor"]
|
32 |
+
|
33 |
+
|
34 |
+
# Urls
|
35 |
+
TEST_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Test.csv"
|
36 |
+
TRAIN_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Train.csv"
|
37 |
+
WEATHER_FILE_URL = "https://raw.githubusercontent.com/valiantezabuku/Yassir-ETA-Prediction-Challenge-For-Azubian-Team-Curium/main/Data/Weather.csv"
|
38 |
+
|
39 |
+
|
40 |
+
# Load environment variables from .env file into a dictionary
|
41 |
+
environment_variables = dotenv_values(ENV_PATH)
|
42 |
+
|
43 |
+
|
44 |
+
# Get the OpenRouteService API key
|
45 |
+
# https://openrouteservice.org/dev/#/home
|
46 |
+
ors_api_key = environment_variables.get("ORS_API_TOKEN")
|
47 |
+
|
48 |
+
# https://maps.app.goo.gl/Fx5rdPs1KeA6jCeB8
|
49 |
+
KENYA_LAT = 0.15456
|
50 |
+
KENYA_LON = 37.908383
|
51 |
+
|
52 |
+
|
53 |
+
BASEMAPS = {
|
54 |
+
"DarkMatter": basemaps.CartoDB.DarkMatter,
|
55 |
+
"Mapnik": basemaps.OpenStreetMap.Mapnik,
|
56 |
+
"NatGeoWorldMap": basemaps.Esri.NatGeoWorldMap,
|
57 |
+
"WorldImagery": basemaps.Esri.WorldImagery,
|
58 |
+
}
|
59 |
+
|
60 |
+
# Yassir
|
61 |
+
BRANDCOLORS = {
|
62 |
+
"red": "#FB2576",
|
63 |
+
"purple-light": "#6316DB",
|
64 |
+
"purple-dark": "#08031A",
|
65 |
+
}
|
66 |
+
|
67 |
+
BRANDTHEMES = {
|
68 |
+
"red": ui.value_box_theme(bg=BRANDCOLORS['red'], fg='white'),
|
69 |
+
"purple-light": ui.value_box_theme(bg=BRANDCOLORS['purple-light'], fg='white'),
|
70 |
+
"purple-dark": ui.value_box_theme(bg=BRANDCOLORS['purple-dark'], fg='white'),
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
# Nairobi, https://maps.app.goo.gl/oPbLBYHuicjrC22J9
|
75 |
+
# National Museum of Kenya, https://maps.app.goo.gl/zbmUpe71admABU9i9
|
76 |
+
# Closest location
|
77 |
+
LOCATIONS = {
|
78 |
+
"Nairobi": {"latitude": -1.3032036, "longitude": 36.6825914},
|
79 |
+
"National Museum of Kenya": {"latitude": -1.2739575, "longitude": 36.8118501},
|
80 |
+
"Mombasa": {"latitude": -1.3293123, "longitude": 36.8717466},
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
HOURS = [f"{i:02}" for i in range(0, 24)]
|
85 |
+
|
86 |
+
MINUTES = [f"{i:02}" for i in range(0, 12)]
|
87 |
+
|
88 |
+
SECONDS = [f"{i:02}" for i in range(0, 60)]
|
89 |
+
|
90 |
+
|
91 |
+
ONE_MINUTE_SEC = 60
|
92 |
+
|
93 |
+
ONE_HOUR_SEC = ONE_MINUTE_SEC * 60
|
94 |
+
|
95 |
+
ONE_DAY_SEC = ONE_HOUR_SEC * 24
|
96 |
+
|
97 |
+
ONE_WEEK_SEC = ONE_DAY_SEC * 7
|
98 |
+
|
99 |
+
|
100 |
+
# Default trip distance
|
101 |
+
TRIP_DISTANCE = 30275.7
|