Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit 3bdf953

Browse files
committed
Final flow diagram and address some feedback
* official architecture.png * Move some details to the step where they make sense * Explain that your Code operator might look different
1 parent 4b9bfa7 commit 3bdf953

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ Our application will be built using IBM Streams on IBM Cloud Pak for Data. IBM S
66

77
To build and deploy our machine learning model, we will use a Jupyter notebook in Watson Studio and a Watson Machine Learning instance. In our examples, both are running on IBM Cloud Pak for Data.
88

9-
Using the Streams Flows editor, we will create a streaming application with the following operators:
10-
11-
* A `Source` operator that generates sample clickstream data
12-
* A `Filter` operator that keeps only the "add to cart" events
13-
* A `Code` operator where we use Python code to arrange the shopping cart items into an input array for scoring
14-
* A `WML Deployment` operator to assign the customer to a cluster
15-
* A `Debug` operator to demonstrate the results
16-
179
## Flow
1810

1911
![architecure](doc/source/images/architecture.png)
@@ -111,6 +103,14 @@ Inside your new project, select the `Settings` tab and click on `Associate a dep
111103

112104
### 6. Create and run a Streams Flow application
113105

106+
Using the Streams Flows editor, we will create a streaming application with the following operators:
107+
108+
* A `Source` operator that generates sample clickstream data
109+
* A `Filter` operator that keeps only the "add to cart" events
110+
* A `Code` operator where we use Python code to arrange the shopping cart items into an input array for scoring
111+
* A `WML Deployment` operator to assign the customer to a cluster
112+
* A `Debug` operator to demonstrate the results
113+
114114
From the project panel, click the `Add to project +` button. Choose the `Streams flow` tile from the list of options.
115115

116116
![add-streams-flow-type](doc/source/images/add-streams-flow-type.png)
@@ -153,21 +153,24 @@ From the `Processing and Analytics` list, select and drag the `Filter` operator
153153

154154
* From the `Processing and Analytics` list, select and drag the `Code` operator onto the canvas
155155
* Connect the `Filter` operator's target to this `Code` operator's source (using drag-and-drop like we did earlier)
156-
* Click on the Code operator to see its associated properties. Select `Python 3.6` as the `Coding Language`.
156+
* Click on the `Code` operator to see its associated properties. Depending on your version, you might see one or both of the following options:
157+
* If you have a `Coding Language` pulldown, select a `Python 3.x` version.
158+
* If you have a `Code Style` pulldown, select `Function`.
157159
* In the `Code` property, paste in the following code:
160+
158161
```python
159162
#
160163
# Preinstalled Python packages can be viewed from the Settings pane.
161164
# In the Settings pane you can also install additional Python packages.
162-
165+
163166
import sys
164167
import logging
165-
168+
166169
# Use this logger for tracing or debugging your code:
167170
logger = logging.getLogger(__name__)
168171
# Example:
169172
# logger.info('Got to step 2...')
170-
173+
171174
# init() function will be called once on flow initialization
172175
# @state a Python dictionary object for keeping state. The state object is passed to the process function
173176
def init(state):
@@ -198,6 +201,7 @@ From the `Processing and Analytics` list, select and drag the `Filter` operator
198201
state['customer_carts'][event['customer_id']] = cart
199202
return { 'customer_id': customer_id, 'cart_list': cart }
200203
```
204+
201205
* Edit the `Output Schema` and set it as follows and click `Apply`:
202206
| Attribute Name | Type |
203207
| --- | --- |

doc/source/images/architecture.png

41.2 KB
Loading

0 commit comments

Comments
 (0)