Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 160
Parameters
This page contains an in-depth discussion of Parameters.
Parametersp = Parameters.getAllDefaultParameters();
// Set a few of your desired parameters...p.setParameterByKey(KEY.INPUT_DIMENSIONS, newint[] { 128, 128 });
p.setParameterByKey(KEY.COLUMN_DIMENSIONS, newint[] { 200 });
p.setParameterByKey(KEY.POTENTIAL_RADIUS, 3);
p.setParameterByKey(KEY.POTENTIAL_PCT, 0.5);
// To clear a parameterp.clearParameter(KEY.POTENTIAL_PCT);
// To get an empty Parameters objectParametersnewCopy = Parameters.empty();
// To get a copyParameterscopy = p.copy();
// To retrieve algorithm only parametersParametersspatial = Parameters.getSpatialDefaultParameters();
Parameterstemporal = Parameters.getTemporalDefaultParameters();
Parametersencoder = Parameters.getEncoderDefaultParameters();
// To merge (union) one Parameters object into anotherParametersspatial = Parameters.getSpatialDefaultParameters();
Parameterstemporal = Parameters.getTemporalDefaultParameters();
spatial.union(temporal); // Now contains only those params specific to the SP and TMLet's use the HotGym fields, "consumption" and "timestamp" as an example:
// This map contains keys which are field names or column names from csv files.Map<String, Map<String, Object>> fieldEncodings = newHashMap<>();
Map<String, Object> inner = newHashMap<>();
// consumptioninner.put("n", 500);
inner.put("w", 21);
inner.put("minVal", 0.0); // Only needed for ScalarEncoder - otherwise can be left emptyinner.put("maxVal", 0.0); // S.A.A for ScalarEncoderinner.put("radius", 0.0);
inner.put("resolution", 0.0);
inner.put("periodic", false);
inner.put("clipInput", false);
inner.put("forced", false); // Used to force a non-standard ratio of "n" and "w" values.inner.put("fieldName", "consumption"); // We'll use "consumption" hereinner.put("fieldType", "float"); // others are "string","datetime","int","float","bool","list"inner.put("encoderType", "RandomDistributedScalarEncoder"); // Use the class name of the encoder.fieldEncodings.put("consumption", inner);
// Timestampinner = newHashMap<>();
inner.put("n", 0);
inner.put("w", 0);
inner.put("minVal", 0.0);
inner.put("maxVal", 0.0);
inner.put("radius", 0.0);
inner.put("resolution", 0.0);
inner.put("periodic", false);
inner.put("clipInput", false);
inner.put("forced", false); inner.put("fieldName", "timestamp");
inner.put("fieldType", "datetime");
inner.put("encoderType", "DateEncoder");
inner.put(KEY.DATEFIELD_TOFD.getFieldName(), newTuple(21,9.5)); // Time of dayinner.put(KEY.DATEFIELD_PATTERN.getFieldName(), "MM/dd/YY HH:mm"); // Date Pattern to be expectedfieldEncodings.put("timestamp", inner);
// Finally add the encoding map to the Parametersp.setParameterByKey(KEY.FIELD_ENCODING_MAP, fieldEncodings);Note: There are other fields (other then TOFD [time of day]) within a DateEncoder which may be individually configured for encoding. For others please see the DateEncoder javadoc, and the Parameters.KEYS. The DateEncoder Parameters keys are (for convenience):
KEY.DATEFIELD_CUSTOMKEY.DATEFIELD_DOFWKEY.DATEFIELD_FORMATTERKEY.DATEFIELD_HOLIDAYKEY.DATEFIELD_PATTERNKEY.DATEFIELD_SEASONKEY.DATEFIELD_TOFDKEY.DATEFIELD_WKENDKEY.DUTY_CYCLE_PERIODThe line: inner.put(KEY.DATEFIELD_TOFD.getFieldName(), new Tuple(21,9.5)); // Time of day
Has an Tuple argument, which is a pair of settings, the first being the number of bits to use for the representation ("0" turns it off). And the second is the "radius" or duration in the parameter's units (for TOFD "time of day", the default radius is 4 (four hours)).
If you should need to customize an Anomaly computer's settings, it can be done like this:
Map<String, Object> params = newHashMap<>();
params.put(KEY_MODE, Mode.PURE);
params.put(KEY_WINDOW_SIZE, 3);
params.put(KEY_USE_MOVING_AVG, true);
AnomalycustomAnomaly = Anomaly.create(params);
// Then insert into network:Network.create("Network API Demo", p)
.add(Network.createRegion("Region 1")
.add(Network.createLayer("Layer 2/3", p)
.add(customAnomaly)));- 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"