/** * 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()); // This is how easy it is to create a full running Network! var sineData = SineGenerator.GenerateSineWave(100, 100 * 20, 10, 1) .Select(s => s.ToString(NumberFormatInfo.InvariantInfo)); string[] header = new[] { "sinedata", "float", "" }; object[] n = { "sine", header.Union(sineData).ToObservable() }; SensorParams parms = SensorParams.Create(SensorParams.Keys.Obs, n); Sensor <ObservableSensor <string[]> > sensor = Sensor <ObservableSensor <string[]> > .Create(ObservableSensor <string[]> .Create, parms); 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)))); }
public void TestSampling() { foreach (double sample in SineGenerator.GenerateSineWave(100, 100, 10, 1)) { Assert.AreEqual(0, sample, 10.0); } }