コード例 #1
0
        public TeacherTester()
        {
            Logger.Log(this, "App start");

            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.19d);
            Network          network         = new Network(nodeFactory, dataPoints, 1000);
            double           addRemoveChance = 0.5;
            PatchFactory     patchFactory    = new PatchFactory(network, nodeFactory, addRemoveChance);
            NetworkTeacher   networkTeacher  = new NetworkTeacher(network, patchFactory);

            Logger.Log(this, String.Format("initial error: {0}", network.CalculateTrainingSqrError()));
            networkTeacher.Teach(
                teachingTime: TimeSpan.FromSeconds(10000000.0d),
                wantedNoOfNodes: 300,
                changesPerPatch: 8,
                patchesPerTeachingSerie: 1
                );
            Logger.Log(this, String.Format("error after learning: {0}", network.CalculateTrainingSqrError()));

            Logger.Log(this, "App finish");
            Console.ReadKey();
        }
コード例 #2
0
        public TeacherTester()
        {
            Logger.Log(this, "App start");

            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.19d);
            Network network = new Network(nodeFactory, dataPoints, 1000);
            double addRemoveChance = 0.5;
            PatchFactory patchFactory = new PatchFactory(network, nodeFactory, addRemoveChance);
            NetworkTeacher networkTeacher = new NetworkTeacher(network, patchFactory);

            Logger.Log(this, String.Format("initial error: {0}", network.CalculateTrainingSqrError()));
            networkTeacher.Teach(
                teachingTime: TimeSpan.FromSeconds(10000000.0d),
                wantedNoOfNodes: 300,
                changesPerPatch: 8,
                patchesPerTeachingSerie: 1
            );
            Logger.Log(this, String.Format("error after learning: {0}", network.CalculateTrainingSqrError()));

            Logger.Log(this, "App finish");
            Console.ReadKey();
        }
コード例 #3
0
 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);
 }
コード例 #4
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);
        }