コード例 #1
0
        public void RunTrials(int numberOfTrials)
        {
            var visualArrayLength = 7; //state and action size are the size of the array in this case
            var learning = new QLearningImplementation(0, 0, visualArrayLength, 6);

            var trainingTrialRunner = new QLearningTrialRunner(_observableModel, _randomNumberProvider,
                fixationLocation => new QLearningActor(learning, _observableModel, fixationLocation));

            var testingTrialRunner = new QLearningTrialRunner(_observableModel, _randomNumberProvider,
                fixationLocation =>
                    new QLearningTestActor(learning, _observableModel, fixationLocation, _cumulativeDataRepository));

            var count = 0;
            while (count < numberOfTrials)
            {
                trainingTrialRunner.Run(learning);
                count++;

                if (count%150 == 0 && count != 0)
                {
                    testingTrialRunner.Run(learning);
                    _cumulativeDataRepository.IncrementTrial(count);
                }
            }
        }
        public void RunTrials(int trialsToLearn, int trialsToAnalyse)
        {
            var visualArrayLength = 7; //state and action size are the size of the array in this case
            var learning = new QLearningImplementation(0, 0, visualArrayLength, 6);

            var trainingTrialRunner = new QLearningTrialRunner(_observableModel, _randomNumberProvider,
                fixationLocation => new QLearningActor(learning, _observableModel, fixationLocation));

            var recordingTrialRunner = new QLearningRecordingTrialRunner(_observableModel, _randomNumberProvider,
                fixationLocation => new QLearningActor(learning, _observableModel, fixationLocation), _dataRepository);

            var learningCount = 0;
            while (learningCount < trialsToLearn)
            {
                trainingTrialRunner.Run(learning);
                learningCount++;
            }

            var analysisCount = 0;
            while (analysisCount < trialsToAnalyse)
            {
                recordingTrialRunner.Run(learning);
                analysisCount++;
            }
        }