Hi NuPIC community and David, I have some questions about how to configure my network with htm.java.
My use case is to let HTM detect an unexpected high load on a server through PING response times. But so far, it produces 0.0 for almost any inputs. Sometimes it returns some value, but which are not reasonable at all. The biggest problem is that I am not sure at all about my configurations. So I highly suspect my configurations are far from correct ones. For your reference, you can see my codes here: CloudSonar project <https://github.com/ggsato/CloudSonar> HTMAnomalyDetector <https://github.com/ggsato/CloudSonar/blob/master/src/com/cloudian/analytics/HTMAnomalyDetector.java> My network configurations are based on(or I say copy and paste) NetworkDemoHarness. They are modified slightly where I believe I understand. Here're my questions. *1. Parameters#getAllDefaultParameters* private static Network createNetwork(Sensor<ObservableSensor<String>> sensor) { *Parameters p = buildParams();* p = p.union(buildEncoderParams()); return Network.create("CloudSonar", p) .add(Network.createRegion("Region") .add(Network.createLayer("Layer", p) .alterParameter(KEY.AUTO_CLASSIFY, Boolean.TRUE) .add(Anomaly.create()) .add(new TemporalMemory()) .add(sensor) ) ); } private static Parameters buildParams() { return* Parameters.getAllDefaultParameters(); <== THIS ONE* } NetworkDemoHarness#getParameters confused me with many parameters. So I picked up only the default ones without overriding anything. Can I start like this? Also, are there any resources to learn about those parameters? *2. Encoders* My inputs are [timestamps, duration_in_micro_sec]. private static String generateCSVInput(PollingJob job) { StringBuffer sb = new StringBuffer(); sb.append(FULL_DATE_FORMAT.format(new Date())); *<== TIMESTAMP* sb.append(CSVUpdateHandler.DELIM); sb.append(TimeUnit.MICROSECONDS.convert(job.pollingStatus.duration(), TimeUnit.NANOSECONDS)); *<== DURATION* return sb.toString(); } I borrowed the config from NetworkDemoHarness#getHotGymFieldEncodingMap and getNetworkDemoFieldEncodingMap(noticed mixed up). Then, modified the red parts: public static Map<String, Map<String, Object>> getNetworkFieldEncodingMap() { Map<String, Map<String, Object>> fieldEncodings = setupMap( null, 0, // n 0, // w 0, 0, 0, 0, null, null, null, "timestamp", "datetime", "DateEncoder"); fieldEncodings = setupMap( fieldEncodings, 50, 21, 0, *10000000*, 0, 0.1, null, Boolean.TRUE, null, *<== 0 ~ 10 sec* CLASSFIER_FIELD, "int", "ScalarEncoder"); fieldEncodings.get("timestamp").put(KEY.DATEFIELD_DOFW.getFieldName(), new Tuple(1, 1.0)); // Day of week fieldEncodings.get("timestamp").put(KEY.DATEFIELD_TOFD.getFieldName(), new Tuple(5, 4.0)); // Time of day fieldEncodings.get("timestamp").put(KEY.DATEFIELD_PATTERN.getFieldName(), *FULL_DATE*); return fieldEncodings; } Why are all the params of DateEncoder 0 or null? What is the difference between ScalarEncoder and RandomDistributedScalarEncoder? I happened to use the larger n and w used by getNetworkDemoFieldEncodingMap. Compared to HotGym demo, durations is much larger than consumption. So a larger n makes sense, but I should have set lower w like 6? I wasn't able to find information how to set those DATEFIELD parameters. PATTERN was obvious, but the other two remained unclear. Especially, what is the Tuple, and those numbers? *3. SpatialPooler* NetworkAPIDemo uses SpatialPooler in every network. But it should be related to spatial inputs, correct? So I dropped it from my network configuration. I have read the JavaDoc, but got no clue. What is it for? *4. Multiple Regions and Layers* I wasn't able to understand the difference between those 3 modes in NetworkAPIDemo. I understand MULTILAYER uses multiple layers, and MULTIREGION uses multiple regions. But when to use which mode in practice? I gave all of these stupid questions, but in overall, I was impressed that the design is easy to understand to integrate htm.java in my own application!! Thanks, Takenori
