/// <summary> /// Configures the current target algorithm and gray box handler. /// </summary> /// <param name="targetAlgorithmFactory">The <see cref="ITargetAlgorithmFactory{TTargetAlgorithm,TInstance,TResult}"/>.</param> /// <param name="parameterTree">The <see cref="ParameterTree"/>.</param> /// <param name="indexOfDesiredPostTuningRun">The index of the desired post tuning run.</param> /// <param name="postTuningGenomeInstancePair">The post tuning genome instance pair.</param> private void ConfigureTargetAlgorithmAndGrayBoxHandler( ITargetAlgorithmFactory <TGrayBoxTargetAlgorithm, TInstance, TResult> targetAlgorithmFactory, ParameterTree parameterTree, int indexOfDesiredPostTuningRun, GenomeInstancePairStringRepresentation postTuningGenomeInstancePair) { var genomeDoubleRepresentation = GenomeDoubleRepresentation.GetGenomeDoubleRepresentationFromGenomeIdentifierStringRepresentation(postTuningGenomeInstancePair.Genome); var genomeTransformation = new GenomeTransformation <CategoricalBinaryEncoding>(parameterTree); var genome = genomeTransformation.ConvertBack(genomeDoubleRepresentation); var runnerDictionary = genome.GetFilteredGenes(parameterTree); this._configuredTargetAlgorithm = targetAlgorithmFactory.ConfigureTargetAlgorithm(runnerDictionary); // Set generation to -1, since this is a post tuning run. var tunerDataRecord = new TunerDataRecord <TResult>( NetworkUtils.GetFullyQualifiedDomainName(), -1, 0, postTuningGenomeInstancePair.Instance, double.NaN, genomeTransformation.GetConverterColumnHeader(), genomeDoubleRepresentation, null); this._grayBoxHandler = new GrayBoxHandler <TInstance, TResult>( this._tunerConfiguration, this._configuredTargetAlgorithm, indexOfDesiredPostTuningRun, tunerDataRecord, false, null, null); }
/// <summary> /// Initializes a new instance of the <see cref="TunerDataRecord{TResult}"/> class. /// </summary> /// <param name="nodeId">The node ID.</param> /// <param name="generationId">The generation ID.</param> /// <param name="tournamentId">The tournament ID.</param> /// <param name="instanceId">The instance ID.</param> /// <param name="grayBoxConfidence">The gray box confidence.</param> /// <param name="genomeHeader">The genome header.</param> /// <param name="genome">The genome.</param> /// <param name="finalResult">The final result.</param> public TunerDataRecord( string nodeId, int generationId, int tournamentId, string instanceId, double grayBoxConfidence, string[] genomeHeader, GenomeDoubleRepresentation genome, TResult finalResult) { this.NodeId = nodeId; this.GenerationId = generationId; this.TournamentId = tournamentId; this.InstanceId = instanceId; this.GrayBoxConfidence = grayBoxConfidence; this.GenomeHeader = genomeHeader; this.Genome = genome; this.FinalResult = finalResult; }
/// <summary> /// Checks if the <paramref name="parentGenome"/> is follows the left or right child node. /// </summary> /// <param name="parentGenome"> /// The parent genome. /// </param> /// <param name="currentNode"> /// The current node. /// </param> /// <returns> /// <c>True</c>, iff the parent's split feature value is less or equal to the split value stored in the current node. /// </returns> private static bool CheckIfParentGoesLeft(GenomeDoubleRepresentation parentGenome, Node currentNode) { return(parentGenome[currentNode.FeatureIndex] <= currentNode.Value); }
/// <summary> /// Initializes a new instance of the <see cref="ParentGenomesConverted"/> class. /// </summary> /// <param name="competitiveParent"> /// The competitive parent. /// </param> /// <param name="nonCompetitiveParent"> /// The non competitive parent. /// </param> public ParentGenomesConverted(GenomeDoubleRepresentation competitiveParent, GenomeDoubleRepresentation nonCompetitiveParent) { this.CompetitiveParent = competitiveParent; this.NonCompetitiveParent = nonCompetitiveParent; }