Exemplo n.º 1
0
        public void SinWaveTrainingTest()
        {
            NodeFuncGenerator             funcGenerator      = new NodeFuncGenerator();
            Dictionary <NodeType, double> nodeProbabilityMap = new Dictionary <NodeType, double>()
            {
                { NodeType.add, 1.0d },
                { NodeType.compare, 1.0d },
                { NodeType.copy, 0.0d },
                { NodeType.inverse, 1.0d },
                { NodeType.log, 1.0d },
                { NodeType.multiply, 1.0d },
                { NodeType.reverse, 1.0d }
            };
            NodeFactory      nodeFactory     = new NodeFactory(funcGenerator, nodeProbabilityMap);
            List <DataPoint> dataPoints      = GenerateSinWaveDataPoints(100, 0.35d);
            Network          network         = new Network(nodeFactory, dataPoints, 1000);
            double           addRemoveChance = 0.5;
            PatchFactory     patchFactory    = new PatchFactory(network, nodeFactory, addRemoveChance);
            NetworkTeacher   networkTeacher  = new NetworkTeacher(network, patchFactory);

            networkTeacher.Teach(TimeSpan.FromSeconds(0.1d), 2000, 3, 30);
        }
        public void SetUp()
        {
            NodeFuncGenerator nodeFuncGenerator = new NodeFuncGenerator();
            NodeFactory       nodeFactory       = new NodeFactory(
                nodeFuncGenerator,
                new Dictionary <NodeType, double>()
            {
                { NodeType.add, 1.0d }
            });

            network = new Network(
                nodeFactory: nodeFactory,
                trainingData: new List <DataPoint>()
            {
                new DataPoint(new List <double>()
                {
                    2.0d, 2.0d, 2.0d
                }, 5.0d)                                                      //IMPORTANT: TODO: was modified from "new DataPoint(new List<double>(){2.0d, 2.0d}, 5.0d)" - now test can work incorrectly
            },
                maxHierarchy: 1000
                );
            patchFactory   = new PatchFactory(network, nodeFactory, 1.0d);
            networkTeacher = new NetworkTeacher(network, patchFactory);
        }