Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Examples

Eron Wright edited this page Mar 16, 2016 · 13 revisions

WikiExamples

A few examples are provided to familiarize you with using NuPIC in a Flink environment.

Running the Examples

  1. Install Flink 1.0.x, and set FLINK_HOME to the install location.
  2. Start a local Flink environment.
  3. Browse to http://localhost:8081/
[flink]$ bin/start-local.sh
Starting jobmanager daemon on host host1.local

The provided bin/run-example script launches the example program into the local Flink environment, using flink run.

Note that the examples are also runnable in your IDE. In that situation an embedded Flink server is automatically launched.

Hot Gym

The Hot Gym example is based on the well-known example in NuPIC: One Hot Gym Prediction Tutorial. See also the HTM.java implementation [here] (https://github.com/numenta/htm.java-examples/tree/master/src/main/java/org/numenta/nupic/examples/napi/hotgym).

The flink-htm embodiment is at flink-htm-examples/.../hotgym/HotGym.scala.

Running

Launch the hotgym Flink job:

[flink-htm-examples]$ bin/run-example hotgym.Demo --input file://`pwd`/data/rec-center-hourly-no-header.csv --output file:///tmp/hotgym-output.csv

Examine the output once the job completes. The output consists of four columns - datetime, Speed (actual), Speed (predicted), Anomaly Score.

[flink-htm-examples]$ cat /tmp/hotgym-output.csv
07/02/10 00:00,21.2,0.0,1.0
07/02/10 01:00,16.4,21.2,1.0
07/02/10 02:00,4.7,16.4,1.0
07/02/10 03:00,4.7,4.7,1.0
07/02/10 04:00,4.6,4.7,1.0
...
12/31/10 19:00,10.5,21.1,0.65
12/31/10 20:00,5.3,10.5,0.075
12/31/10 21:00,5.1,5.3,0.175
12/31/10 22:00,5.0,5.1,0.025
Clone this wiki locally