예제 #1
0
        public void ScoreInformationHistoryScoresGenerationInformationObjectsWithoutTestInstances()
        {
            var incumbent1 = new Genome();

            incumbent1.SetGene(ExtractIntegerValue.ParameterName, new Allele <int>(-2));
            var generationInformation = new GenerationInformation(0, TimeSpan.Zero, 0, typeof(int), new ImmutableGenome(incumbent1), "id");

            var scorer = new GenerationInformationScorer <InstanceSeedFile, IntegerResult>(
                this._generationEvaluationActor,
                this._resultStorageActor,
                this._runEvaluator);

            scorer.ScoreInformationHistory(
                new List <GenerationInformation> {
                generationInformation
            },
                trainingInstances: GenerationInformationScorerTest.CreateInstances(startSeed: 50, number: 4),
                testInstances: new List <InstanceSeedFile>());

            Assert.Equal(
                -103,
                generationInformation.IncumbentTrainingScore);
            Assert.Null(
                generationInformation.IncumbentTestScore);
        }
예제 #2
0
        public void ScoreInformationHistoryThrowsForMissingHistory()
        {
            var scorer = new GenerationInformationScorer <InstanceSeedFile, IntegerResult>(
                this._generationEvaluationActor,
                this._resultStorageActor,
                this._runEvaluator);

            Assert.Throws <ArgumentNullException>(
                () => scorer.ScoreInformationHistory(
                    informationHistory: null,
                    trainingInstances: GenerationInformationScorerTest.CreateInstances(0, 1),
                    testInstances: GenerationInformationScorerTest.CreateInstances(0, 1)));
        }
예제 #3
0
        public void ScoreInformationHistoryThrowsForMissingTestInstancesSet()
        {
            var scorer = new GenerationInformationScorer <InstanceSeedFile, IntegerResult>(
                this._generationEvaluationActor,
                this._resultStorageActor,
                this._runEvaluator);

            var dummyInformation = new GenerationInformation(0, TimeSpan.Zero, 0, typeof(int), new ImmutableGenome(new Genome()), "id");

            Assert.Throws <ArgumentNullException>(
                () => scorer.ScoreInformationHistory(
                    informationHistory: new List <GenerationInformation> {
                dummyInformation
            },
                    trainingInstances: GenerationInformationScorerTest.CreateInstances(0, 1),
                    testInstances: null));
        }
예제 #4
0
        public void ScoreInformationHistoryThrowsForEmptySetOfTrainingInstances()
        {
            var scorer = new GenerationInformationScorer <InstanceSeedFile, IntegerResult>(
                this._genomeSorter,
                this._resultStorageActor,
                this._runEvaluator);

            var dummyInformation = new GenerationInformation(0, 0, typeof(int), new ImmutableGenome(new Genome()));

            Assert.Throws <ArgumentOutOfRangeException>(
                () => scorer.ScoreInformationHistory(
                    informationHistory: new List <GenerationInformation> {
                dummyInformation
            },
                    trainingInstances: new List <InstanceSeedFile>(),
                    testInstances: GenerationInformationScorerTest.CreateInstances(0, 1)));
        }