Esempio n. 1
0
  ///////////////////////////////////////////
  //             HELPER METHODS            //
  ///////////////////////////////////////////
  private Network getLoadedDayOfWeekNetwork() {
    Parameters p = NetworkTestHarness.getParameters().copy();
    p = p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
    p.set(KEY.RANDOM, new FastRandom(42));

    Sensor<ObservableSensor<String[]>> sensor =
        Sensor.create(
            ObservableSensor::create,
            SensorParams.create(
                Keys::obs,
                new Object[] {
                  "name",
                  PublisherSupplier.builder()
                      .addHeader("dayOfWeek")
                      .addHeader("number")
                      .addHeader("B")
                      .build()
                }));

    Network network =
        Network.create("test network", p)
            .add(
                Network.createRegion("r1")
                    .add(
                        Network.createLayer("1", p)
                            .alterParameter(KEY.AUTO_CLASSIFY, true)
                            .add(Anomaly.create())
                            .add(new TemporalMemory())
                            .add(new SpatialPooler())
                            .add(sensor)));

    return network;
  }
  /**
   * Creates and returns a {@link Network} for demo processing
   *
   * @return
   */
  Network createNetwork() {
    org.numenta.nupic.Parameters temporalParams = createParameters();
    PALayer<?> l = new PALayer("Layer 2/3", null, temporalParams);
    l.setPADepolarize(0.0); // 0.25
    l.setVerbosity(1);
    PASpatialPooler sp = new PASpatialPooler();

    network =
        Network.create("Cortical.io API Demo", temporalParams)
            .add(Network.createRegion("Region 1").add(l.add(new TemporalMemory()).add(sp)));
    return network;
  }