Performing Streaming Learning Using a Clustree Model¶
Purpose¶
This sample demonstrates how to perform unsupervised streaming learning on a set of data points using a Clustree model.
Before you begin:
- Download
siddhi-gpl-execution-streamingml-x.x.x.jar
from here and place it in the<SI_TOOLING_HOME>/lib
directory. - Copy the
<SI_TOOLING_HOME>/samples/artifacts/ClusTreeSample/clusTreeTestFeed.json
file and place it in the<SI_TOOLING_HOME>/wso2/server/deployment/simulation-configs
directory. - Copy the
<SI_TOOLING_HOME>/samples/artifacts/ClusTreeSample/clusTreeFileTest.csv
file and place it in the<SI_TOOLING_HOME>/wso2/server/deployment/csv-files
directory. - Save the sample Siddhi application in Streaming Integrator Tooling.
Executing the Sample¶
To execute the sample open the saved Siddhi application in Streaming Integrator Tooling, and start it by clicking the Start button (shown below) or by clicking Run => Run.
If the Siddhi application starts successfully, the following message appears in the console.
ClusTreeTestApp.siddhi - Started Successfully!
Testing the Sample¶
To test the sample Siddhi application, simulate multiple events via CSV file in the Streaming Integrator Tooling as follows:
-
To open the Event Simulator, click the Event Simulator icon.
This opens the event simulation panel.
-
In the Feed Simulation tab of the panel you can see that the clusTreeTestFeed.csv file is loaded.
-
Press the play button to start simulation.
Viewing the Results¶
After clicking the play button see the output on the console, that are produced according to the simulation from csv file.
Click here to view the sample Siddhi application.
@App:name("ClusTreeTestApp")
define stream InputStream (x double, y double);
@sink(type='log')
define stream logStream (closestCentroidCoordinate1 double,closestCentroidCoordinate2 double,x double, y double);
@info(name = 'query1')
from InputStream#streamingml:clusTree(2, 10, 20, 5, 50, x, y)
select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y
insert into logStream;