|
45 | 45 | }, |
46 | 46 | { |
47 | 47 | "cell_type": "code", |
48 | | - "execution_count": 1, |
| 48 | + "execution_count": null, |
49 | 49 | "id": "78326a44", |
50 | 50 | "metadata": {}, |
51 | | - "outputs": [ |
52 | | - { |
53 | | - "name": "stdout", |
54 | | - "output_type": "stream", |
55 | | - "text": [ |
56 | | - "Connected. Call `.close()` to terminate connection gracefully.\n", |
57 | | - "\n", |
58 | | - "Logged in to project, explore it here https://hopsworks0.logicalclocks.com/p/120\n", |
59 | | - "Connected. Call `.close()` to terminate connection gracefully.\n" |
60 | | - ] |
61 | | - } |
62 | | - ], |
| 51 | + "outputs": [], |
63 | 52 | "source": [ |
64 | 53 | "import hopsworks\n", |
65 | 54 | "import numpy as np\n", |
|
82 | 71 | }, |
83 | 72 | { |
84 | 73 | "cell_type": "code", |
85 | | - "execution_count": 2, |
| 74 | + "execution_count": null, |
86 | 75 | "id": "42e1c8b0", |
87 | 76 | "metadata": {}, |
88 | 77 | "outputs": [], |
|
120 | 109 | }, |
121 | 110 | { |
122 | 111 | "cell_type": "code", |
123 | | - "execution_count": 3, |
| 112 | + "execution_count": null, |
124 | 113 | "id": "a1ad04fa", |
125 | 114 | "metadata": {}, |
126 | | - "outputs": [ |
127 | | - { |
128 | | - "name": "stdout", |
129 | | - "output_type": "stream", |
130 | | - "text": [ |
131 | | - "Feature Group created successfully, explore it at \n", |
132 | | - "https://hopsworks0.logicalclocks.com/p/120/fs/68/fg/14\n" |
133 | | - ] |
134 | | - }, |
135 | | - { |
136 | | - "data": { |
137 | | - "application/vnd.jupyter.widget-view+json": { |
138 | | - "model_id": "719e5cea6dca47bdbfd8e87f5b145c45", |
139 | | - "version_major": 2, |
140 | | - "version_minor": 0 |
141 | | - }, |
142 | | - "text/plain": [ |
143 | | - "Uploading Dataframe: 0.00% | | Rows 0/106020 | Elapsed Time: 00:00 | Remaining Time: ?" |
144 | | - ] |
145 | | - }, |
146 | | - "metadata": {}, |
147 | | - "output_type": "display_data" |
148 | | - }, |
149 | | - { |
150 | | - "name": "stdout", |
151 | | - "output_type": "stream", |
152 | | - "text": [ |
153 | | - "Launching job: trans_fg_1_offline_fg_materialization\n", |
154 | | - "Job started successfully, you can follow the progress at \n", |
155 | | - "https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fg_1_offline_fg_materialization/executions\n" |
156 | | - ] |
157 | | - } |
158 | | - ], |
| 115 | + "outputs": [], |
159 | 116 | "source": [ |
160 | 117 | "# Feature Group\n", |
161 | 118 | "trans_fg = fs.get_or_create_feature_group(\n", |
|
174 | 131 | }, |
175 | 132 | { |
176 | 133 | "cell_type": "code", |
177 | | - "execution_count": 4, |
| 134 | + "execution_count": null, |
178 | 135 | "id": "176ad761", |
179 | 136 | "metadata": {}, |
180 | | - "outputs": [ |
181 | | - { |
182 | | - "name": "stdout", |
183 | | - "output_type": "stream", |
184 | | - "text": [ |
185 | | - "Feature view created successfully, explore it at \n", |
186 | | - "https://hopsworks0.logicalclocks.com/p/120/fs/68/fv/trans_fv/version/1\n", |
187 | | - "Training dataset job started successfully, you can follow the progress at \n", |
188 | | - "https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fv_1_create_fv_td_16022024133852/executions\n" |
189 | | - ] |
190 | | - }, |
191 | | - { |
192 | | - "name": "stderr", |
193 | | - "output_type": "stream", |
194 | | - "text": [ |
195 | | - "VersionWarning: Incremented version to `1`.\n" |
196 | | - ] |
197 | | - } |
198 | | - ], |
| 137 | + "outputs": [], |
199 | 138 | "source": [ |
200 | 139 | "query = trans_fg.select([\"fraud_label\", \"amount\", \"cc_num\"])\n", |
201 | 140 | "\n", |
202 | | - "min_max_scaler = fs.get_transformation_function(name=\"min_max_scaler\")\n", |
| 141 | + "# Import transformation functions from Hopsworks.\n", |
| 142 | + "from hopsworks.hsfs.builtin_transformations import min_max_scaler\n", |
203 | 143 | "\n", |
204 | 144 | "transformation_functions = [\n", |
205 | 145 | " min_max_scaler(\"amount\") \n", |
|
224 | 164 | }, |
225 | 165 | { |
226 | 166 | "cell_type": "code", |
227 | | - "execution_count": 5, |
| 167 | + "execution_count": null, |
228 | 168 | "id": "29ae9922", |
229 | 169 | "metadata": {}, |
230 | | - "outputs": [ |
231 | | - { |
232 | | - "name": "stdout", |
233 | | - "output_type": "stream", |
234 | | - "text": [ |
235 | | - "Training dataset job started successfully, you can follow the progress at \n", |
236 | | - "https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fv_1_create_fv_td_16022024134233/executions\n" |
237 | | - ] |
238 | | - }, |
239 | | - { |
240 | | - "name": "stderr", |
241 | | - "output_type": "stream", |
242 | | - "text": [ |
243 | | - "VersionWarning: Incremented version to `2`.\n" |
244 | | - ] |
245 | | - } |
246 | | - ], |
| 170 | + "outputs": [], |
247 | 171 | "source": [ |
248 | 172 | "_, _ = trans_fv.create_train_validation_test_split(\n", |
249 | 173 | " description = 'test extra filters',\n", |
|
275 | 199 | }, |
276 | 200 | { |
277 | 201 | "cell_type": "code", |
278 | | - "execution_count": 6, |
| 202 | + "execution_count": null, |
279 | 203 | "id": "b82685fb", |
280 | 204 | "metadata": {}, |
281 | 205 | "outputs": [], |
|
303 | 227 | }, |
304 | 228 | { |
305 | 229 | "cell_type": "code", |
306 | | - "execution_count": 7, |
| 230 | + "execution_count": null, |
307 | 231 | "id": "703da6cc", |
308 | 232 | "metadata": {}, |
309 | 233 | "outputs": [], |
|
325 | 249 | }, |
326 | 250 | { |
327 | 251 | "cell_type": "code", |
328 | | - "execution_count": 8, |
| 252 | + "execution_count": null, |
329 | 253 | "id": "28a891bf", |
330 | 254 | "metadata": {}, |
331 | 255 | "outputs": [], |
|
347 | 271 | }, |
348 | 272 | { |
349 | 273 | "cell_type": "code", |
350 | | - "execution_count": 9, |
| 274 | + "execution_count": null, |
351 | 275 | "id": "fa5651be", |
352 | 276 | "metadata": {}, |
353 | 277 | "outputs": [], |
|
382 | 306 | }, |
383 | 307 | { |
384 | 308 | "cell_type": "code", |
385 | | - "execution_count": 10, |
| 309 | + "execution_count": null, |
386 | 310 | "id": "dce248fb", |
387 | 311 | "metadata": {}, |
388 | 312 | "outputs": [], |
|
408 | 332 | }, |
409 | 333 | { |
410 | 334 | "cell_type": "code", |
411 | | - "execution_count": 11, |
| 335 | + "execution_count": null, |
412 | 336 | "id": "7fcc0236", |
413 | 337 | "metadata": {}, |
414 | | - "outputs": [ |
415 | | - { |
416 | | - "data": { |
417 | | - "text/plain": [ |
418 | | - "FeatureMonitoringConfig('fg_amount_monitoring_reference_value', STATISTICS_COMPARISON)" |
419 | | - ] |
420 | | - }, |
421 | | - "execution_count": 11, |
422 | | - "metadata": {}, |
423 | | - "output_type": "execute_result" |
424 | | - } |
425 | | - ], |
| 338 | + "outputs": [], |
426 | 339 | "source": [ |
427 | 340 | "fg_amount_monitoring_reference_value.with_reference_value(\n", |
428 | 341 | " value=100,\n", |
|
444 | 357 | }, |
445 | 358 | { |
446 | 359 | "cell_type": "code", |
447 | | - "execution_count": 12, |
| 360 | + "execution_count": null, |
448 | 361 | "id": "b5ecd419", |
449 | 362 | "metadata": {}, |
450 | 363 | "outputs": [], |
|
477 | 390 | }, |
478 | 391 | { |
479 | 392 | "cell_type": "code", |
480 | | - "execution_count": 13, |
| 393 | + "execution_count": null, |
481 | 394 | "id": "2acd07e4", |
482 | 395 | "metadata": {}, |
483 | 396 | "outputs": [], |
|
530 | 443 | }, |
531 | 444 | { |
532 | 445 | "cell_type": "code", |
533 | | - "execution_count": 14, |
| 446 | + "execution_count": null, |
534 | 447 | "id": "07c863f2", |
535 | 448 | "metadata": {}, |
536 | 449 | "outputs": [], |
|
554 | 467 | }, |
555 | 468 | { |
556 | 469 | "cell_type": "code", |
557 | | - "execution_count": 15, |
| 470 | + "execution_count": null, |
558 | 471 | "id": "58483800", |
559 | 472 | "metadata": {}, |
560 | | - "outputs": [ |
561 | | - { |
562 | | - "data": { |
563 | | - "text/plain": [ |
564 | | - "[FeatureMonitoringConfig('fg_full_monitoring_sliding', STATISTICS_COMPUTATION),\n", |
565 | | - " FeatureMonitoringConfig('fg_full_monitoring', STATISTICS_COMPUTATION),\n", |
566 | | - " FeatureMonitoringConfig('fg_amount_monitoring_reference_value', STATISTICS_COMPARISON),\n", |
567 | | - " FeatureMonitoringConfig('fg_amount_monitoring_reference_sliding', STATISTICS_COMPARISON),\n", |
568 | | - " FeatureMonitoringConfig('fg_amount_feature_monitoring', STATISTICS_COMPUTATION)]" |
569 | | - ] |
570 | | - }, |
571 | | - "execution_count": 15, |
572 | | - "metadata": {}, |
573 | | - "output_type": "execute_result" |
574 | | - } |
575 | | - ], |
| 473 | + "outputs": [], |
576 | 474 | "source": [ |
577 | 475 | "trans_fg.get_feature_monitoring_configs()" |
578 | 476 | ] |
|
587 | 485 | }, |
588 | 486 | { |
589 | 487 | "cell_type": "code", |
590 | | - "execution_count": 16, |
| 488 | + "execution_count": null, |
591 | 489 | "id": "3372c2d8", |
592 | 490 | "metadata": {}, |
593 | | - "outputs": [ |
594 | | - { |
595 | | - "data": { |
596 | | - "text/plain": [ |
597 | | - "FeatureMonitoringConfig('fg_full_monitoring', STATISTICS_COMPUTATION)" |
598 | | - ] |
599 | | - }, |
600 | | - "execution_count": 16, |
601 | | - "metadata": {}, |
602 | | - "output_type": "execute_result" |
603 | | - } |
604 | | - ], |
| 491 | + "outputs": [], |
605 | 492 | "source": [ |
606 | 493 | "trans_fg.get_feature_monitoring_configs(name=\"fg_full_monitoring\")" |
607 | 494 | ] |
|
624 | 511 | "hash": "e1ddeae6eefc765c17da80d38ea59b893ab18c0c0904077a035ef84cfe367f83" |
625 | 512 | }, |
626 | 513 | "kernelspec": { |
627 | | - "display_name": "Python 3", |
| 514 | + "display_name": "Python 3 (ipykernel)", |
628 | 515 | "language": "python", |
629 | 516 | "name": "python3" |
630 | 517 | }, |
|
638 | 525 | "name": "python", |
639 | 526 | "nbconvert_exporter": "python", |
640 | 527 | "pygments_lexer": "ipython3", |
641 | | - "version": "3.10.11" |
| 528 | + "version": "3.12.5" |
642 | 529 | } |
643 | 530 | }, |
644 | 531 | "nbformat": 4, |
|
0 commit comments