Beispiel #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 Algorithms.SpatialPooler()))
                        .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 Algorithms.SpatialPooler()))
                        .Add(Network.Network.CreateLayer("Layer 4", p)
                             .Add(Sensor <FileInfo> .Create(FileSensor.Create, SensorParams.Create(
                                                                SensorParams.Keys.Path, "", ResourceLocator.Path(typeof(Resources), "rec-center-hourly.csv")))))
                        .Connect("Layer 2/3", "Layer 4"))
                   .Connect("Region 1", "Region 2"));
        }
Beispiel #2
0
        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);
        }
Beispiel #3
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 CreateBasicNetworkCla()
        {
            Parameters p = NetworkDemoHarness.GetParameters();

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

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

            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(new Algorithms.SpatialPooler())
                             .Add(Sensor <FileInfo> .Create(FileSensor.Create,
                                                            SensorParams.Create(SensorParams.Keys.Path, "", "rec-center-hourly.csv"))))));
        }
Beispiel #4
0
        public void TestGetNetworkDemoTestEncoderParams()
        {
            Parameters p = NetworkDemoHarness.GetNetworkDemoTestEncoderParams();

            Assert.AreEqual(28, p.Size());
        }
Beispiel #5
0
        public void TestGetHotGymTestEncoderParams()
        {
            Map <String, Map <String, Object> > fieldEncodings = NetworkDemoHarness.GetHotGymFieldEncodingMap();

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

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

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