tree: 6838eb5b7e783adc9c0c840ebad40ff2a9ec4db7 [path history] [tgz]
  1. project/
  2. build.sbt
  3. engine.json
  4. HelloWorld.scala
  5. README.md
examples/experimental/scala-local-helloworld/README.md

My First “Hello World” Engine

Prepare training data:

$ cd $PIO_HOME/examples/scala-local-helloworld
$ cp ../data/helloworld/data1.csv ../data/helloworld/data.csv

Build engine:

$ ../../bin/pio build

Train:

$ ../../bin/pio train

Example output:

2014-08-05 17:06:02,638 INFO  APIDebugWorkflow$ - Metrics is null. Stop here
2014-08-05 17:06:02,769 INFO  APIDebugWorkflow$ - Run information saved with ID: 201408050005

Deploy:

$ ../../bin/pio deploy

Retrieve prediction:

$ curl -H "Content-Type: application/json" -d '{ "day": "Mon" }' http://localhost:8000/queries.json

Output:

{"temperature":75.5}

Retrieve prediction:

$ curl -H "Content-Type: application/json" -d '{ "day": "Tue" }' http://localhost:8000/queries.json

Output:

{"temperature":80.5}

4. Re-training

Re-train with new data:

$ cd $PIO_HOME/examples/scala-local-helloworld
$ cp ../data/helloworld/data2.csv ../data/helloworld/data.csv
$ ../../bin/pio train
$ ../../bin/pio deploy
$ curl -H "Content-Type: application/json" -d '{ "day": "Mon" }' http://localhost:8000/queries.json

{"temperature":76.66666666666667}