Exemple #1
0
        /**
         * Creates a {@link Network} containing 2 {@link Region}s with multiple
         * {@link PALayer}s in each.
         *
         * @return a multi-region Network
         */
        internal Network.Network CreateMultiRegionNetwork()
        {
            Parameters p = NetworkDemoHarness.GetParameters();

            p = p.Union(NetworkDemoHarness.GetNetworkDemoTestEncoderParams());

            return(Network.Network.Create("Network API Demo", p)
                   .Add(Network.Network.CreateRegion("Region 1")
                        .Add(Network.Network.CreateLayer("Layer 2/3", p)
                             .AlterParameter(Parameters.KEY.AUTO_CLASSIFY, true)
                             .Add(Anomaly.Create())
                             .Add(new TemporalMemory()))
                        .Add(Network.Network.CreateLayer("Layer 4", p)
                             .Add(new PASpatialPooler()))
                        .Connect("Layer 2/3", "Layer 4"))
                   .Add(Network.Network.CreateRegion("Region 2")
                        .Add(Network.Network.CreateLayer("Layer 2/3", p)
                             .AlterParameter(Parameters.KEY.AUTO_CLASSIFY, true)
                             .Add(Anomaly.Create())
                             .Add(new TemporalMemory())
                             .Add(new PASpatialPooler()))
                        .Add(Network.Network.CreateLayer("Layer 4", p)
                             .Add(Sensor <FileInfo> .Create(FileSensor.Create, SensorParams.Create(
                                                                SensorParams.Keys.Path, "", ResourceLocator.Path(typeof(Resources), "rec-center-15m.csv")))))
                        .Connect("Layer 2/3", "Layer 4"))
                   .Connect("Region 1", "Region 2"));
        }
Exemple #2
0
        /**
         * Creates a basic {@link Network} with 1 {@link Region} and 1 {@link PALayer}. However
         * this basic network contains all algorithmic components.
         *
         * @return  a basic Network
         */
        internal Network.Network CreateBasicNetwork()
        {
            Parameters p = NetworkDemoHarness.GetParameters();

            p = p.Union(NetworkDemoHarness.GetNetworkDemoTestEncoderParams());
            p.SetParameterByKey(Parameters.KEY.MIN_THRESHOLD, 22);        // 22 18
            p.SetParameterByKey(Parameters.KEY.ACTIVATION_THRESHOLD, 16); // 18
            p.SetParameterByKey(Parameters.KEY.STIMULUS_THRESHOLD, 0.0);  // 0.0
            p.SetParameterByKey(Parameters.KEY.CELLS_PER_COLUMN, 1);      // 1

            Region r = Network.Network.CreateRegion("Region 1");
            PALayer <IInference> l = new PALayer <IInference>("Layer 2/3", null, p);

            l.SetPADepolarize(0.0); // 0.25
            l.SetVerbosity(0);
            PASpatialPooler sp     = new PASpatialPooler();
            string          infile = "rec-center-15m.csv";

            // This is how easy it is to create a full running Network!

            return(Network.Network.Create("Network API Demo", p)
                   .Add(r.Add(l.AlterParameter(Parameters.KEY.AUTO_CLASSIFY, true)
                              .Add(Anomaly.Create())
                              .Add(new TemporalMemory())
                              .Add(sp)
                              .Add(Sensor <FileInfo> .Create(FileSensor.Create,
                                                             SensorParams.Create(SensorParams.Keys.Path, "", ResourceLocator.Path(typeof(Resources), infile)))))));
        }
        public void TestSetupMap()
        {
            Map <String, Map <String, Object> > m = NetworkDemoHarness.SetupMap(null, 23, 2, 0.0, 0.9, 22.0, 3.0, false, false, null, "cogmission", "ai", "works");

            Assert.IsNotNull(m);

            // Make sure omission of key doesn't insert null or a default value
            Assert.IsTrue(!m.ContainsKey("forced"));

            Assert.AreEqual(1, m.Count);
            Assert.AreEqual(12, m.Get("cogmission").Count);
        }
        public void TestGetNetworkDemoTestEncoderParams()
        {
            Parameters p = NetworkDemoHarness.GetNetworkDemoTestEncoderParams();

            Assert.AreEqual(30, p.Size());
        }
        public void TestGetHotGymTestEncoderParams()
        {
            Map <String, Map <String, Object> > fieldEncodings = NetworkDemoHarness.GetHotGymFieldEncodingMap();

            Assert.AreEqual(2, fieldEncodings.Count);
        }
        public void TestGetDayDemoFieldEncodingMap()
        {
            Map <String, Map <string, object> > fieldEncodings = NetworkDemoHarness.GetDayDemoFieldEncodingMap();

            Assert.AreEqual(1, fieldEncodings.Count);
        }
        public void TestGetParameters()
        {
            Parameters p = NetworkDemoHarness.GetParameters();

            Assert.AreEqual(66, p.Size());
        }