/** * 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")); }
/** * 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 TestGetNetworkDemoTestEncoderParams() { Parameters p = NetworkDemoHarness.GetNetworkDemoTestEncoderParams(); Assert.AreEqual(30, p.Size()); }