/// <summary> /// Configures the current gray box handler. /// </summary> private void ConfigureGrayBoxHandler() { var genomeTransformation = new GenomeTransformation <CategoricalBinaryEncoding>(this._parameterTree); var genomeDoubleRepresentation = genomeTransformation.ConvertGenomeToArray(this._currentEvaluation.GenomeInstancePair.Genome.CreateMutableGenome()); var tunerDataRecord = new TunerDataRecord <TResult>( NetworkUtils.GetFullyQualifiedDomainName(), this._currentEvaluation.GenerationId, this._currentEvaluation.TournamentId, this._currentEvaluation.GenomeInstancePair.Instance.ToId(), double.NaN, genomeTransformation.GetConverterColumnHeader(), genomeDoubleRepresentation, null); this._grayBoxHandler = new GrayBoxHandler <TInstance, TResult>( this._configuration, this._configuredTargetAlgorithm as IGrayBoxTargetAlgorithm <TInstance, TResult>, this._id, tunerDataRecord, this._currentEvaluation.UseGrayBoxInEvaluation && this._successfullyDeserializedGrayBoxRandomForest, this._customGrayBoxMethods, this._grayBoxRandomForest); }
public void TransformGeneToDoubleArrayOrdinal() { var tree = this.BuildCategoricalDomainParameterTree(); // Set genes to values. this._genome.SetGene("1intDom", new Allele <int>(0)); this._genome.SetGene("2intDom", new Allele <int>(1)); this._genome.SetGene("3catDom", new Allele <int>(4)); var converter = new GenomeTransformation <CategoricalOrdinalEncoding>(tree); var result = converter.ConvertGenomeToArray(this._genome); var expected = new[] { 0d, 1d, 3d }; Assert.True(expected.SequenceEqual(result), "Expected different double-representation."); }
/// <summary> /// Gets all competitive genomes as <see cref="GenomeDoubleRepresentation"/>. /// </summary> /// <returns>The competitive genomes as <see cref="GenomeDoubleRepresentation"/>.</returns> public List <GenomeDoubleRepresentation> GetAllCompetitiveGenomesAsGenomeDoubleRepresentation() { var converter = new GenomeTransformation <CategoricalBinaryEncoding>(this.ParameterTree); var listOfGenomeDoubleRepresentations = this.MostRecentSorting .Select(point => (GenomeDoubleRepresentation)converter.ConvertGenomeToArray(point.Genome.CreateMutableGenome())).ToList(); return(listOfGenomeDoubleRepresentations); }
/// <summary> /// Gets all competitive genomes as <see cref="GenomeDoubleRepresentation"/>. /// </summary> /// <returns>The competitive genomes as <see cref="GenomeDoubleRepresentation"/>.</returns> public List <GenomeDoubleRepresentation> GetAllCompetitiveGenomesAsGenomeDoubleRepresentation() { var converter = new GenomeTransformation <CategoricalBinaryEncoding>(this._parameterTree); var listOfGenomeDoubleRepresentations = this._population.GetCompetitiveIndividuals() .Select(genome => (GenomeDoubleRepresentation)converter.ConvertGenomeToArray(genome)).ToList(); return(listOfGenomeDoubleRepresentations); }