This repository has been archived by the owner on Apr 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from ChariniNana/master
Add prediction sample
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
1. Copy {WSO2DASHome}/samples/0025/ml-prediction-sample.siddhi file to {WSO2DASHome}/deployment/siddhi-files. | ||
In ml-prediction-sample.siddhi file, replace "<CARBON-HOME>" with the absolute path to DAS home. | ||
|
||
2. Start the worker using ./{WSO2DASHome}/bin/worker.sh | ||
|
||
3. Run the following curl command to simulate prediction using the test-model | ||
curl -X POST http://localhost:9090/simulation/single -H 'content-type: text/plain' | ||
-d '{"siddhiAppName": "ml-prediction-sample", | ||
"streamName": "inputStream", | ||
"timestamp": null, | ||
"data": ["2", "84", "0", "0", "0", "0.0", "0.304", "21"]}' | ||
|
||
4. See the output in the WSO2DAS terminal |
22 changes: 22 additions & 0 deletions
22
modules/samples/artifacts/0025/ml-prediction-sample.siddhi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@App:name("ml-prediction-sample") | ||
|
||
-- Please refer to https://docs.wso2.com/display/DAS400/Quick+Start+Guide on getting started with DAS editor. | ||
|
||
define stream inputStream (NumPregnancies double, PG2 double, DBP double, TSFT double, SI2 double, BMI double, DPF double, Age double); | ||
|
||
define stream outputStream (NumPregnancies double, PG2 double, DBP double, TSFT double, SI2 double, BMI double, DPF double, Age double, Class double); | ||
|
||
@info(name = 'query1') | ||
from inputStream#ml:predict('<CARBON-HOME>/samples/artifacts/0024/test-model','double') | ||
select * | ||
insert into outputStream; | ||
|
||
from outputStream#log("OutputLog") | ||
insert into tempStream; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
Binary file not shown.