Performing Regression Tasks via an Imported Tensorflow Model¶
Purpose¶
This application demonstrates how to import a pretrained Tensorflow model WSO2 Streaming Integrator to perform a regression task.
Prerequisites¶
- Replace
{SI_HOME}
with absolute path to the Streaming Integrator Tooling home directory. - Save this sample.
- If there is no syntax error, the following message is shown on the console:
Executing the Sample¶
- Start the Siddhi application by clicking on 'Run'.
- If the Siddhi application starts successfully, the following messages are shown on the console:
Testing the Sample¶
Send events through one or more of the following methods.
Send events to ProductionInputStream
, via event simulator¶
- Open the event simulator by clicking on the second icon or pressing Ctrl+Shift+I.
- In the Single Simulation tab of the panel, specify the values as follows:
- Siddhi App Name: TensorFlowTestApp
- Stream Name: InputStream
-
In the x field, enter the following and then click Send to send the event.
-
Send some more events.
Send events to the simulator HTTP endpoint through the curl command¶
- Open a new terminal and issue the following command:
- If there is no error, the following messages are shown on the terminal:
Publish events with Postman¶
- Install 'Postman' application from Chrome web store.
- Launch the application.
- Make a 'Post' request to the 'http://localhost:9390/simulation/single' endpoint. Set the Content-Type to 'text/plain' and set the request body in text as follows:
- Click 'send'. If there is no error, the following messages are shown on the console:
Viewing the Results¶
See the output on the terminal.
@App:name("TensorFlowTestApp")
define stream InputStream (x string);
@sink(type='log')
define stream OutputStream (outputPoint0 double, outputPoint1 double);
@info(name = 'query1')
from InputStream#tensorFlow:predict('{SI_HOME}/samples/artifacts/TensorflowSample/Regression', 'inputPoint', 'outputPoint', x)
select outputPoint0, outputPoint1
insert into OutputStream;