Skip to content

Commit 0f4e71d

Browse files
authored
Merge pull request #1544 from PrAyAg9/prayag_patch1
Solves #1543 :- EV Battery Life Prediction
2 parents 40fd8d2 + db9c16c commit 0f4e71d

18 files changed

+83282
-0
lines changed

Prediction Models/EV Battery LIfe Prediction/Model/final_notebooks_5.3-ssn-stacker.ipynb

Lines changed: 773 additions & 0 deletions
Large diffs are not rendered by default.

Prediction Models/EV Battery LIfe Prediction/Model/final_notebooks_Final-XGBoost.ipynb

Lines changed: 8789 additions & 0 deletions
Large diffs are not rendered by default.

Prediction Models/EV Battery LIfe Prediction/Model/notebooks_Final-Data-Prep-NB.ipynb

Lines changed: 3018 additions & 0 deletions
Large diffs are not rendered by default.

Prediction Models/EV Battery LIfe Prediction/Model/notebooks_XGBoost-part-GridSearchCV.ipynb

Lines changed: 2472 additions & 0 deletions
Large diffs are not rendered by default.

Prediction Models/EV Battery LIfe Prediction/Model/notebooks_dask_xgb_1.1.ipynb

Lines changed: 736 additions & 0 deletions
Large diffs are not rendered by default.

Prediction Models/EV Battery LIfe Prediction/Model/notebooks_flow_file.ipynb

Lines changed: 949 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 388 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,388 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 6,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"data": {
10+
"application/javascript": [
11+
"IPython.notebook.set_autosave_interval(60000)"
12+
]
13+
},
14+
"metadata": {},
15+
"output_type": "display_data"
16+
},
17+
{
18+
"name": "stdout",
19+
"output_type": "stream",
20+
"text": [
21+
"Autosaving every 60 seconds\n"
22+
]
23+
}
24+
],
25+
"source": [
26+
"%autosave 60"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 7,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"BUCKET_NAME = \"msil_raw\"\n",
36+
"FOLDER_NAME = \"training_data\"\n",
37+
"TRAINFILE = \"trainset.csv\"\n",
38+
"VALIDFILE = \"validset.csv\"\n",
39+
"TESTFILE = \"testset.csv\""
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": 8,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": [
48+
"import google.datalab.storage as storage\n",
49+
"import pandas as pd\n",
50+
"from io import BytesIO\n",
51+
"\n",
52+
"import numpy as np\n",
53+
"import matplotlib.pyplot as plt\n",
54+
"import seaborn as sns\n",
55+
"import xgboost as xgb\n",
56+
"from sklearn.model_selection import GridSearchCV\n",
57+
"import time\n",
58+
"from datetime import datetime\n",
59+
"from scipy import integrate"
60+
]
61+
},
62+
{
63+
"cell_type": "code",
64+
"execution_count": 4,
65+
"metadata": {},
66+
"outputs": [],
67+
"source": [
68+
"# setting up the parameters\n",
69+
"plt.rcParams[\"figure.figsize\"] = (10, 10)\n",
70+
"pd.set_option(\"display.max_rows\", 200)\n",
71+
"pd.set_option(\"display.max_columns\", 200)\n",
72+
"pd.set_option(\"precision\", 15)\n",
73+
"sns.set_style(\"darkgrid\")"
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": 5,
79+
"metadata": {},
80+
"outputs": [
81+
{
82+
"data": {
83+
"text/html": [
84+
"<div>\n",
85+
"<style scoped>\n",
86+
" .dataframe tbody tr th:only-of-type {\n",
87+
" vertical-align: middle;\n",
88+
" }\n",
89+
"\n",
90+
" .dataframe tbody tr th {\n",
91+
" vertical-align: top;\n",
92+
" }\n",
93+
"\n",
94+
" .dataframe thead th {\n",
95+
" text-align: right;\n",
96+
" }\n",
97+
"</style>\n",
98+
"<table border=\"1\" class=\"dataframe\">\n",
99+
" <thead>\n",
100+
" <tr style=\"text-align: right;\">\n",
101+
" <th></th>\n",
102+
" <th>IMEI</th>\n",
103+
" <th>Year</th>\n",
104+
" <th>Month</th>\n",
105+
" <th>Day</th>\n",
106+
" <th>Hour</th>\n",
107+
" <th>Minute</th>\n",
108+
" <th>Seconds</th>\n",
109+
" <th>tp</th>\n",
110+
" <th>sp</th>\n",
111+
" <th>EVVSP</th>\n",
112+
" <th>EVVSP_delta</th>\n",
113+
" <th>EVVSP_change</th>\n",
114+
" <th>EVGPO</th>\n",
115+
" <th>EVOAS</th>\n",
116+
" <th>EVIGM_Latest</th>\n",
117+
" <th>EVCOM_Latest</th>\n",
118+
" <th>EVACO_Z</th>\n",
119+
" <th>EVIRT_Min</th>\n",
120+
" <th>EVDI2</th>\n",
121+
" <th>EVBMI_Latest</th>\n",
122+
" <th>EVBMA_Latest</th>\n",
123+
" <th>EVVAC</th>\n",
124+
" <th>EVVAC_delta</th>\n",
125+
" <th>EVVAC_change</th>\n",
126+
" <th>EVODO</th>\n",
127+
" <th>EVODOH</th>\n",
128+
" <th>EVSMA_EWMA</th>\n",
129+
" <th>EVSMA_delta</th>\n",
130+
" <th>EVSMA_in</th>\n",
131+
" <th>combine</th>\n",
132+
" </tr>\n",
133+
" </thead>\n",
134+
" <tbody>\n",
135+
" <tr>\n",
136+
" <th>0</th>\n",
137+
" <td>7</td>\n",
138+
" <td>2018</td>\n",
139+
" <td>11</td>\n",
140+
" <td>15</td>\n",
141+
" <td>10</td>\n",
142+
" <td>58</td>\n",
143+
" <td>49</td>\n",
144+
" <td>1</td>\n",
145+
" <td>0.0</td>\n",
146+
" <td>0.0</td>\n",
147+
" <td>0.0</td>\n",
148+
" <td>0.0</td>\n",
149+
" <td>0</td>\n",
150+
" <td>26.0</td>\n",
151+
" <td>-51</td>\n",
152+
" <td>-51</td>\n",
153+
" <td>-1008.0</td>\n",
154+
" <td>-41</td>\n",
155+
" <td>20</td>\n",
156+
" <td>21.5</td>\n",
157+
" <td>21.5</td>\n",
158+
" <td>0.0</td>\n",
159+
" <td>0.0</td>\n",
160+
" <td>0.0</td>\n",
161+
" <td>690</td>\n",
162+
" <td>0.0</td>\n",
163+
" <td>93.200000000000003</td>\n",
164+
" <td>0.0</td>\n",
165+
" <td>93.200000000000003</td>\n",
166+
" <td>1606</td>\n",
167+
" </tr>\n",
168+
" <tr>\n",
169+
" <th>1</th>\n",
170+
" <td>7</td>\n",
171+
" <td>2018</td>\n",
172+
" <td>11</td>\n",
173+
" <td>15</td>\n",
174+
" <td>10</td>\n",
175+
" <td>58</td>\n",
176+
" <td>50</td>\n",
177+
" <td>1</td>\n",
178+
" <td>1000.0</td>\n",
179+
" <td>0.0</td>\n",
180+
" <td>0.0</td>\n",
181+
" <td>0.0</td>\n",
182+
" <td>0</td>\n",
183+
" <td>26.0</td>\n",
184+
" <td>-51</td>\n",
185+
" <td>-51</td>\n",
186+
" <td>-1004.0</td>\n",
187+
" <td>-41</td>\n",
188+
" <td>20</td>\n",
189+
" <td>21.5</td>\n",
190+
" <td>21.5</td>\n",
191+
" <td>0.0</td>\n",
192+
" <td>0.0</td>\n",
193+
" <td>0.0</td>\n",
194+
" <td>690</td>\n",
195+
" <td>0.0</td>\n",
196+
" <td>93.200000000000003</td>\n",
197+
" <td>0.0</td>\n",
198+
" <td>93.200000000000003</td>\n",
199+
" <td>1606</td>\n",
200+
" </tr>\n",
201+
" <tr>\n",
202+
" <th>2</th>\n",
203+
" <td>7</td>\n",
204+
" <td>2018</td>\n",
205+
" <td>11</td>\n",
206+
" <td>15</td>\n",
207+
" <td>10</td>\n",
208+
" <td>58</td>\n",
209+
" <td>51</td>\n",
210+
" <td>1</td>\n",
211+
" <td>2000.0</td>\n",
212+
" <td>0.0</td>\n",
213+
" <td>0.0</td>\n",
214+
" <td>0.0</td>\n",
215+
" <td>0</td>\n",
216+
" <td>26.0</td>\n",
217+
" <td>-51</td>\n",
218+
" <td>-51</td>\n",
219+
" <td>-1016.0</td>\n",
220+
" <td>-41</td>\n",
221+
" <td>20</td>\n",
222+
" <td>21.5</td>\n",
223+
" <td>21.5</td>\n",
224+
" <td>0.0</td>\n",
225+
" <td>0.0</td>\n",
226+
" <td>0.0</td>\n",
227+
" <td>690</td>\n",
228+
" <td>0.0</td>\n",
229+
" <td>93.200000000000003</td>\n",
230+
" <td>0.0</td>\n",
231+
" <td>93.200000000000003</td>\n",
232+
" <td>1606</td>\n",
233+
" </tr>\n",
234+
" <tr>\n",
235+
" <th>3</th>\n",
236+
" <td>7</td>\n",
237+
" <td>2018</td>\n",
238+
" <td>11</td>\n",
239+
" <td>15</td>\n",
240+
" <td>10</td>\n",
241+
" <td>58</td>\n",
242+
" <td>52</td>\n",
243+
" <td>1</td>\n",
244+
" <td>3000.0</td>\n",
245+
" <td>0.0</td>\n",
246+
" <td>0.0</td>\n",
247+
" <td>0.0</td>\n",
248+
" <td>0</td>\n",
249+
" <td>26.0</td>\n",
250+
" <td>-51</td>\n",
251+
" <td>-51</td>\n",
252+
" <td>-1002.0</td>\n",
253+
" <td>-41</td>\n",
254+
" <td>20</td>\n",
255+
" <td>21.5</td>\n",
256+
" <td>21.5</td>\n",
257+
" <td>0.0</td>\n",
258+
" <td>0.0</td>\n",
259+
" <td>0.0</td>\n",
260+
" <td>690</td>\n",
261+
" <td>0.0</td>\n",
262+
" <td>93.200000000000003</td>\n",
263+
" <td>0.0</td>\n",
264+
" <td>93.200000000000003</td>\n",
265+
" <td>1606</td>\n",
266+
" </tr>\n",
267+
" <tr>\n",
268+
" <th>4</th>\n",
269+
" <td>7</td>\n",
270+
" <td>2018</td>\n",
271+
" <td>11</td>\n",
272+
" <td>15</td>\n",
273+
" <td>10</td>\n",
274+
" <td>58</td>\n",
275+
" <td>53</td>\n",
276+
" <td>1</td>\n",
277+
" <td>4000.0</td>\n",
278+
" <td>0.0</td>\n",
279+
" <td>0.0</td>\n",
280+
" <td>0.0</td>\n",
281+
" <td>0</td>\n",
282+
" <td>26.0</td>\n",
283+
" <td>-51</td>\n",
284+
" <td>-51</td>\n",
285+
" <td>-1012.0</td>\n",
286+
" <td>-41</td>\n",
287+
" <td>20</td>\n",
288+
" <td>21.5</td>\n",
289+
" <td>21.5</td>\n",
290+
" <td>0.0</td>\n",
291+
" <td>0.0</td>\n",
292+
" <td>0.0</td>\n",
293+
" <td>690</td>\n",
294+
" <td>0.0</td>\n",
295+
" <td>93.200000000000003</td>\n",
296+
" <td>0.0</td>\n",
297+
" <td>93.200000000000003</td>\n",
298+
" <td>1606</td>\n",
299+
" </tr>\n",
300+
" </tbody>\n",
301+
"</table>\n",
302+
"</div>"
303+
],
304+
"text/plain": [
305+
" IMEI Year Month Day Hour Minute Seconds tp sp EVVSP \\\n",
306+
"0 7 2018 11 15 10 58 49 1 0.0 0.0 \n",
307+
"1 7 2018 11 15 10 58 50 1 1000.0 0.0 \n",
308+
"2 7 2018 11 15 10 58 51 1 2000.0 0.0 \n",
309+
"3 7 2018 11 15 10 58 52 1 3000.0 0.0 \n",
310+
"4 7 2018 11 15 10 58 53 1 4000.0 0.0 \n",
311+
"\n",
312+
" EVVSP_delta EVVSP_change EVGPO EVOAS EVIGM_Latest EVCOM_Latest \\\n",
313+
"0 0.0 0.0 0 26.0 -51 -51 \n",
314+
"1 0.0 0.0 0 26.0 -51 -51 \n",
315+
"2 0.0 0.0 0 26.0 -51 -51 \n",
316+
"3 0.0 0.0 0 26.0 -51 -51 \n",
317+
"4 0.0 0.0 0 26.0 -51 -51 \n",
318+
"\n",
319+
" EVACO_Z EVIRT_Min EVDI2 EVBMI_Latest EVBMA_Latest EVVAC EVVAC_delta \\\n",
320+
"0 -1008.0 -41 20 21.5 21.5 0.0 0.0 \n",
321+
"1 -1004.0 -41 20 21.5 21.5 0.0 0.0 \n",
322+
"2 -1016.0 -41 20 21.5 21.5 0.0 0.0 \n",
323+
"3 -1002.0 -41 20 21.5 21.5 0.0 0.0 \n",
324+
"4 -1012.0 -41 20 21.5 21.5 0.0 0.0 \n",
325+
"\n",
326+
" EVVAC_change EVODO EVODOH EVSMA_EWMA EVSMA_delta \\\n",
327+
"0 0.0 690 0.0 93.200000000000003 0.0 \n",
328+
"1 0.0 690 0.0 93.200000000000003 0.0 \n",
329+
"2 0.0 690 0.0 93.200000000000003 0.0 \n",
330+
"3 0.0 690 0.0 93.200000000000003 0.0 \n",
331+
"4 0.0 690 0.0 93.200000000000003 0.0 \n",
332+
"\n",
333+
" EVSMA_in combine \n",
334+
"0 93.200000000000003 1606 \n",
335+
"1 93.200000000000003 1606 \n",
336+
"2 93.200000000000003 1606 \n",
337+
"3 93.200000000000003 1606 \n",
338+
"4 93.200000000000003 1606 "
339+
]
340+
},
341+
"execution_count": 5,
342+
"metadata": {},
343+
"output_type": "execute_result"
344+
}
345+
],
346+
"source": [
347+
"mybucket = storage.Bucket(BUCKET_NAME)\n",
348+
"data_csv = mybucket.object(FOLDER_NAME + \"/\" + TESTFILE)\n",
349+
"\n",
350+
"uri = data_csv.uri\n",
351+
"%gcs read --object $uri --variable data\n",
352+
"\n",
353+
"testset = pd.read_csv(BytesIO(data))\n",
354+
"testset.head()"
355+
]
356+
},
357+
{
358+
"cell_type": "code",
359+
"execution_count": null,
360+
"metadata": {},
361+
"outputs": [],
362+
"source": [
363+
"import data_proces"
364+
]
365+
}
366+
],
367+
"metadata": {
368+
"kernelspec": {
369+
"display_name": "Python 3",
370+
"language": "python",
371+
"name": "python3"
372+
},
373+
"language_info": {
374+
"codemirror_mode": {
375+
"name": "ipython",
376+
"version": 3
377+
},
378+
"file_extension": ".py",
379+
"mimetype": "text/x-python",
380+
"name": "python",
381+
"nbconvert_exporter": "python",
382+
"pygments_lexer": "ipython3",
383+
"version": "3.5.6"
384+
}
385+
},
386+
"nbformat": 4,
387+
"nbformat_minor": 2
388+
}

0 commit comments

Comments
 (0)