Skip to content

Commit

Permalink
Merge branch 'development' of github.com:v3io/tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharon-iguazio committed Feb 2, 2020
2 parents 9a4e6a3 + 91b7ad5 commit 89646ba
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- [Natural language processing (NLP)](demos/nlp/nlp-example.ipynb)
- [Stream enrichment](demos/stream-enrich/stream-enrich.ipynb)
- [Smart stock trading](demos/stocks/01-gen-demo-data.ipynb)
- [Loaction-based recommendations](demos/location-based-recommendations/01-generate-stores-and-customers.ipynb)
- [Location-based recommendations](demos/location-based-recommendations/01-generate-stores-and-customers.ipynb)
- [Real-time-user-segmentation](demos/slots-stream/real-time-user-segmentation.ipynb)

Additional demos (see the [download instructions](#mlrun-demos-download)) —
Expand Down
Binary file modified assets/images/igz-self-service-platform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 31 additions & 10 deletions demos/slots-stream/real-time-user-segmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"\n",
"You can configure the duration of the sliding window, the user-behavior rule, and other aspecs of the application's logic by changing the values of the relevant [workflow constants](#user-seg-demo-workflow-constants) and/or by changing the implementation of the [Nuclio function](#user-seg-demo-nuclio-func-def).\n",
"\n",
"> **Note:** You need to edit the code in the [Configure Nuclio](#user-seg-demo-nuclio-init-nuclio-config) section to set the `spec.triggers.slotStream.username` variable to your user password."
"> **Note:** You need to edit the code in the [Configure Nuclio](#user-seg-demo-nuclio-init-nuclio-config) section to set the `spec.triggers.slotStream.password` variable to your user password."
]
},
{
Expand Down Expand Up @@ -151,7 +151,8 @@
"import v3io_frames as v3f\n",
"import pandas as pd\n",
"import os\n",
"# a.py\n",
"import requests\n",
"from base64 import b64encode\n",
"from params import *\n",
"\n",
"LAST_TIME = datetime.datetime.now()\n",
Expand Down Expand Up @@ -245,7 +246,7 @@
"\n",
"Write (ingest) data into the stream in bulk batches of 1,000 items to improve performance.\n",
"\n",
"- [Generate Timestamps](#user-seg-demo-write-to-stream-gen-timestamps)\n",
"- [Write Initialization](#user-seg-demo-write-to-stream-init)\n",
"- [Populate the Stream with Purchase Data](#user-seg-demo-write-to-stream-purchases)\n",
"- [Populate the Stream with Spin Data](#user-seg-demo-write-to-stream-spins)\n",
"- [Verify the Data Ingestion](#user-seg-demo-write-to-stream-verify)"
Expand All @@ -255,10 +256,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id=\"user-seg-demo-write-to-stream-gen-timestamps\"></a>\n",
"### Generate Timestamps\n",
"\n",
"Generate random timestamps to be used for the ingested stream data."
"<a id=\"user-seg-demo-write-to-stream-init\"></a>\n",
"### Write Initialization"
]
},
{
Expand All @@ -268,10 +267,32 @@
"outputs": [],
"source": [
"# nuclio: ignore\n",
"\n",
"\n",
"# Send-payloads function\n",
"def send_payload(records):\n",
" if (len(records) > 0):\n",
" payload = {\n",
" \"Records\": records\n",
" }\n",
" requests.post(url, json=payload, headers=headers, verify=False)\n",
"\n",
"# PutRecords initialization\n",
"url = 'http://v3io-webapi:8081/users/' + os.getenv('V3IO_USERNAME') + \\\n",
" '/examples/' + STREAM + '/'\n",
"headers = {\n",
" \"Content-Type\": \"application/json\",\n",
" \"X-v3io-function\": \"PutRecords\",\n",
" \"X-v3io-session-key\": os.getenv('V3IO_ACCESS_KEY')\n",
" }\n",
"records = []\n",
"\n",
"# Generate random timestamps\n",
"timestamps_list = []\n",
"for i in range(len_spins+len_purchases):\n",
" timestamps_list.append((LAST_TIME - datetime.timedelta(hours = random.random() * DURATION_HOURS)).strftime('%Y-%m-%d %H:%M:%S.%f UTC'))"
" timestamps_list.append((LAST_TIME - datetime.timedelta(\n",
" hours=random.random() * DURATION_HOURS))\n",
" .strftime('%Y-%m-%d %H:%M:%S.%f UTC'))"
]
},
{
Expand Down Expand Up @@ -901,7 +922,7 @@
"source": [
"%%nuclio cmd -c\n",
"pip install --upgrade pip\n",
"pip install v3io_frames"
"pip install v3io-frames==0.6.10"
]
},
{
Expand All @@ -911,7 +932,7 @@
"<a id=\"user-seg-demo-nuclio-init-nuclio-config\"></a>\n",
"### Configure Nuclio\n",
"\n",
"> **Note:** You need to edit the definition of the `spec.triggers.slotStream.username` variable to set the password for the running platform user."
"> **Note:** You need to edit the definition of the `spec.triggers.slotStream.password` variable to set the password for the running platform user."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion getting-started/gpu-cudf-vs-pd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
"source": [
"!pip install pytimeparse\n",
"!pip install -i https://test.pypi.org/simple/ v3io-generator --upgrade\n",
"!pin install faker"
"!pip install faker"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion igz-tutorials-get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cp -rf ${TEMP_DIR}/getting-started ${DEST_DIR}
cp -rf ${TEMP_DIR}/demos ${DEST_DIR}
cp -rf ${TEMP_DIR}/*.ipynb ${DEST_DIR}
cp -rf ${TEMP_DIR}/assets ${DEST_DIR}
cp -rf ${TEMP_DIR}/experiment-tracking ${DEST_DIR}
cp -f ${TEMP_DIR}/README.md ${TEMP_DIR}/LICENSE ${DEST_DIR}
echo "Deleting temporary ${DEST_DIR} directory ..."
rm -rf ${TEMP_DIR}
Expand Down
2 changes: 1 addition & 1 deletion welcome.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
" - [Natural language processing (NLP)](demos/nlp/nlp-example.ipynb)\n",
" - [Stream enrichment](demos/stream-enrich/stream-enrich.ipynb)\n",
" - [Smart stock trading](demos/stocks/01-gen-demo-data.ipynb)\n",
" - [Loaction-based recommendations](demos/location-based-recommendations/01-generate-stores-and-customers.ipynb)\n",
" - [Location-based recommendations](demos/location-based-recommendations/01-generate-stores-and-customers.ipynb)\n",
" - [Real-time-user-segmentation](demos/slots-stream/real-time-user-segmentation.ipynb)\n",
" \n",
" Additional demos (see the [download instructions](#mlrun-demos-download)) &mdash;\n",
Expand Down

0 comments on commit 89646ba

Please sign in to comment.