Skip to content

Commit 301de4a

Browse files
authored
Concept drift section update to new nuclio-jupyter / mlrun versions (#82)
* Adapted concept drift stream trigger to new version * Updated stream to parquet for newer nuclio versions
1 parent 24c3645 commit 301de4a

File tree

4 files changed

+119
-193
lines changed

4 files changed

+119
-193
lines changed

Diff for: concept_drift/concept_drift.ipynb

+28-20
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@
3737
},
3838
{
3939
"cell_type": "code",
40-
"execution_count": 3,
40+
"execution_count": 4,
4141
"metadata": {
4242
"tags": []
4343
},
4444
"outputs": [],
4545
"source": [
4646
"%%nuclio cmd -c\n",
4747
"python -m pip install scikit-multiflow==0.4.1\n",
48-
"python -m pip install v3io_frames"
48+
"python -m pip install v3io_frames\n",
49+
"python -m pip install nuclio-jupyter"
4950
]
5051
},
5152
{
@@ -56,9 +57,11 @@
5657
},
5758
"outputs": [
5859
{
59-
"output_type": "stream",
6060
"name": "stdout",
61-
"text": "%nuclio: setting spec.build.baseImage to 'mlrun/ml-models'\n"
61+
"output_type": "stream",
62+
"text": [
63+
"%nuclio: setting spec.build.baseImage to 'mlrun/ml-models'\n"
64+
]
6265
}
6366
],
6467
"source": [
@@ -183,7 +186,7 @@
183186
" 'pagehinkley_threshold': pagehinkley_threshold,\n",
184187
" 'ddm_warning_level': ddm_warning_level,\n",
185188
" 'ddm_out_control': ddm_out_control_level}) \n",
186-
" fn.add_trigger('labeled_stream', V3IOStreamTrigger(url=input_stream))\n",
189+
" fn.add_trigger('labeled_stream', V3IOStreamTrigger(url=input_stream, name='labeled_stream'))\n",
187190
" fn.apply(mount_v3io())\n",
188191
" fn.deploy(project=context.project)"
189192
]
@@ -201,7 +204,8 @@
201204
"cell_type": "markdown",
202205
"metadata": {},
203206
"source": [
204-
"## Local test"
207+
"## Local test\n",
208+
"A usecase based run example"
205209
]
206210
},
207211
{
@@ -219,18 +223,22 @@
219223
"metadata": {},
220224
"outputs": [],
221225
"source": [
226+
"container = 'bigdata'\n",
227+
"base_table = os.path.join('/', container, 'network-operations')\n",
228+
"stream_consumer_group = 'cd'\n",
229+
"artifacts_path = os.path.join(os.getcwd(), 'artifacts')\n",
230+
"\n",
222231
"task = NewTask(name='concept_drift_deployer',\n",
223232
" project='network-operations',\n",
224233
" handler=concept_drift_deployer,\n",
225234
" params={'models': ['ddm', 'eddm', 'pagehinkley'],\n",
226235
" 'label_col': 'is_error',\n",
227236
" 'prediction_col': 'yscore',\n",
228-
" 'hub_url': '/User/functions/{name}/function.yaml',\n",
229-
" 'output_tsdb': '/bigdata/network-operations/drift_tsdb',\n",
230-
" 'input_stream': 'http://v3io-webapi:8081/bigdata/network-operations/inference_stream@cd2',\n",
231-
" 'output_stream': '/bigdata/network-operations/drift_stream'},\n",
237+
" 'output_tsdb': os.path.join(base_table, 'drift_tsdb'),\n",
238+
" 'input_stream': f'http://{os.environ[\"V3IO_API\"]}{os.path.join(base_table, 'inference_stream')}@{stream_consumer_group}',\n",
239+
" 'output_stream': os.path.join(base_table, 'drift_stream')},\n",
232240
" inputs={'base_dataset': 'store://network-operations/test_test_set_preds'},\n",
233-
" artifact_path='/User/demo-network-operations/artifacts/')"
241+
" artifact_path=artifacts_path)"
234242
]
235243
},
236244
{
@@ -251,7 +259,7 @@
251259
},
252260
{
253261
"cell_type": "code",
254-
"execution_count": 23,
262+
"execution_count": 1,
255263
"metadata": {},
256264
"outputs": [],
257265
"source": [
@@ -262,23 +270,23 @@
262270
},
263271
{
264272
"cell_type": "code",
265-
"execution_count": 24,
273+
"execution_count": 3,
266274
"metadata": {},
267275
"outputs": [
268276
{
269277
"name": "stdout",
270278
"output_type": "stream",
271279
"text": [
272-
"> 2020-07-27 07:49:39,770 [info] function spec saved to path: function.yaml\n"
280+
"> 2020-12-23 12:39:26,663 [info] function spec saved to path: function.yaml\n"
273281
]
274282
},
275283
{
276284
"data": {
277285
"text/plain": [
278-
"<mlrun.runtimes.kubejob.KubejobRuntime at 0x7f94677f1828>"
286+
"<mlrun.runtimes.kubejob.KubejobRuntime at 0x7fb816dc7450>"
279287
]
280288
},
281-
"execution_count": 24,
289+
"execution_count": 3,
282290
"metadata": {},
283291
"output_type": "execute_result"
284292
}
@@ -353,9 +361,9 @@
353361
],
354362
"metadata": {
355363
"kernelspec": {
356-
"display_name": "Python 3.7.6 64-bit ('mlrun': conda)",
364+
"display_name": "Python [conda env:root] *",
357365
"language": "python",
358-
"name": "python37664bitmlruncondaffd934acfa434683ba806e65bc7d5bad"
366+
"name": "conda-root-py"
359367
},
360368
"language_info": {
361369
"codemirror_mode": {
@@ -367,9 +375,9 @@
367375
"name": "python",
368376
"nbconvert_exporter": "python",
369377
"pygments_lexer": "ipython3",
370-
"version": "3.7.6-final"
378+
"version": "3.7.6"
371379
}
372380
},
373381
"nbformat": 4,
374382
"nbformat_minor": 4
375-
}
383+
}

0 commit comments

Comments
 (0)