-
Notifications
You must be signed in to change notification settings - Fork 160
Sensors
David Ray edited this page Jun 9, 2015
·
28 revisions
The term Sensor means to "go out and get information, or a conduit through which information is received".
Sensors in HTM.java are "Network reception or retrieval objects". They come in 4 flavors; only 3 of which are of any concern to a user, the fourth (HTMSensor) is a wrapper around the other three - which is HTM Network aware. These are:
- FileSensor - Attaches to a file source specified by a path, and reads in CSV data, line by line.
- URISensor - Connects to a URL, and reads in CSV data line by line.
- ObservableSensor - Created by passing in a Publisher which can be programmatically fed CSV data, line by line.
Sensors are general data retrieval mechanisms and could potentially be used outside of the NAPI framework. A Decorator-Pattern is used with them to wrap them in an HTMSensor which grants it HTM Network awareness and transforms the Stream into an HTM specific source of data (i.e. The Header retrievable from the HTMSensor must be 3 lines long to support HTM Network specific headers).
Here is an example of Sensor creation for all 3 types:
Sensor.create(FileSensor::create, SensorParams.create(
Keys::path, "", ResourceLocator.path("rec-center-hourly.csv")))
Sensor.create(URISensor::create, SensorParams.create(
Keys::uri, "", "http://www.metaware.us/nupic/rec-center-hourly.csv"))
Publisher manual = Publisher.builder()
.addHeader("timestamp,consumption")
.addHeader("datetime,float")
.addHeader("T,B") //see SensorFlags.java for more info
.build();
Sensor.create(ObservableSensor::create, SensorParams.create(
Keys::obs, "", manual))
// From there, for "manual" input call something like:
// (When the Sensor has been added to a Network, of course)
manual.onNext("7/2/10 0:00,21.2");
manual.onNext("7/2/10 1:00,34.0");
manual.onNext("7/2/10 2:00,40.4");
manual.onNext("7/2/10 3:00,123.4");
- Introduction (Home)
- History & News Archives...
- Usability
- Architecture
- NAPI Quick Start Guide
- NAPI In Depth
- Saving Your Network: PersistenceAPI Serialization
- Roadmap
- Browse Java Docs
- Build Instructions
- Eclipse (Dev Setup)
- Anomaly Prediction
- Test Coverage Reports
- [Cortical.io Demos] (https://github.com/numenta/htm.java-examples/tree/master/src/main/java/org/numenta/nupic/examples/cortical_io)
- Hot Gym Demo
- Performance Benchmarks with jmh - blog
- BLOG: Join the "cogmission"