protected override void UpdateResults(BCCPosteriors posteriors, RunMode mode) { base.UpdateResults(posteriors, mode); var wordsPosteriors = posteriors as BCCWordsPosteriors; if (wordsPosteriors?.ProbWordPosterior != null) { this.ProbWords = wordsPosteriors.ProbWordPosterior; } }
protected virtual void UpdateResults(BCCPosteriors posteriors, RunMode mode) { if (mode == RunMode.LookAheadExperiment) { if (posteriors.TrueLabel != null) { for (int t = 0; t < posteriors.TrueLabel.Length; t++) { LookAheadTrueLabel[Mapping.TaskIndexToId[t]] = posteriors.TrueLabel[t]; } } if (posteriors.WorkerConfusionMatrix != null) { for (int w = 0; w < posteriors.WorkerConfusionMatrix.Length; w++) { LookAheadWorkerConfusionMatrix[Mapping.WorkerIndexToId[w]] = posteriors.WorkerConfusionMatrix[w]; } } } else if (mode == RunMode.Prediction) { if (posteriors.WorkerConfusionMatrix != null) { for (int w = 0; w < posteriors.WorkerConfusionMatrix.Length; w++) { WorkerPrediction[Mapping.WorkerIndexToId[w]] = new Dictionary <string, Discrete>(); for (int tw = 0; tw < posteriors.WorkerPrediction[w].Length; tw++) { WorkerPrediction[Mapping.WorkerIndexToId[w]][Mapping.TaskIndexToId[tw]] = posteriors.WorkerPrediction[w][tw]; } } } } else { // Update results for BCC BackgroundLabelProb = posteriors.BackgroundLabelProb; if (posteriors.WorkerConfusionMatrix != null) { for (int w = 0; w < posteriors.WorkerConfusionMatrix.Length; w++) { WorkerConfusionMatrix[Mapping.WorkerIndexToId[w]] = posteriors.WorkerConfusionMatrix[w]; } } if (posteriors.TrueLabel != null) { for (int t = 0; t < posteriors.TrueLabel.Length; t++) { TrueLabel[Mapping.TaskIndexToId[t]] = posteriors.TrueLabel[t]; } } if (posteriors.TrueLabelConstraint != null) { for (int t = 0; t < posteriors.TrueLabelConstraint.Length; t++) { TrueLabelConstraint[Mapping.TaskIndexToId[t]] = posteriors.TrueLabelConstraint[t]; } } this.ModelEvidence = posteriors.Evidence; } }