This sample regression engine reads data from file system.
Edit the file path in engine.json
, change filepath
of datasource
to an absolute path that points to lr_data.py
$ cat engine.json ... "datasource": { "filepath": <absolute_path_to_lr_data.txt> } ...
This engine comes with two algorithms.
v
defined in the parameter.Below is an example of algorithms
defines in engine.json
, it invokes three algorithms,
"algorithms": [ { "name": "OLS", "params": {} }, { "name": "Default", "params": { "v": 2.0 } }, { "name": "Default", "params": { "v": 4.0 } } ]
The Serving
class returns the average of all these prediction to the user.
$ pio build $ pio train $ pio deploy --port 9997
$ curl -X POST http://localhost:9997/queries.json -d \ '[1.80,0.87,2.41,0.35,-0.21,1.35,0.51,1.55,-0.20,1.32]' 2.2434392991944025
2.24... is the prediction result.
You can evaluate the engine instance too.
$ pio eval --batch JavaRegressionEval \ --metrics-class io.prediction.examples.java.regression.MeanSquareMetrics ... 2014-09-24 03:23:07,170 INFO spark.SparkContext - Job finished: collect at Workflow.scala:695, took 0.092829 s 2014-09-24 03:23:07,284 WARN workflow.CoreWorkflow$ - java.lang.String is not a NiceRendering instance. 2014-09-24 03:23:07,296 INFO workflow.CoreWorkflow$ - Saved engine instance with ID: OCCUucs7QBOOG--9kIWFEw
And you will see you result in PredictionIO dashboard. To start dashboard:
$ pio dashboard