/// <summary> /// Applies the specified inputs. /// </summary> /// <param name="inputs">The inputs.</param> /// <param name="featureBuckets">The feature buckets.</param> /// <param name="priors">The priors.</param> /// <param name="results">The results.</param> /// <param name="mode">The mode.</param> /// <param name="showFactorGraph">if set to <c>true</c> [show factor graph].</param> /// <exception cref="System.NotImplementedException">Not implemented for this model</exception> public virtual void Apply(Inputs inputs, FeatureSet featureBuckets, Priors priors, ref Results results, InputMode mode, bool showFactorGraph = false) { this.Engine.ShowFactorGraph = showFactorGraph; if (mode.HasFlag(InputMode.Validation)) { this.SetObservedValues(inputs.Validation.Instances, featureBuckets, InputMode.Validation, priors); results.Validation = new Results.ResultsSet { IsRepliedTo = this.Engine.Infer <Bernoulli[]>(this.RepliedTo) }; } if (mode.HasFlag(InputMode.Testing)) { this.SetObservedValues(inputs.Test.Instances, featureBuckets, InputMode.Testing, priors); results.Test = new Results.ResultsSet { IsRepliedTo = this.Engine.Infer <Bernoulli[]>(this.RepliedTo) }; } if (mode.HasFlag(InputMode.TrainAndValidation)) { this.SetObservedValues(inputs.TrainAndValidation.Instances, featureBuckets, InputMode.TrainAndValidation, priors); results.Validation = new Results.ResultsSet { IsRepliedTo = this.Engine.Infer <Bernoulli[]>(this.RepliedTo) }; } this.Engine.ShowFactorGraph = this.ShowFactorGraph; }
/// <summary> /// Applies the specified inputs. /// </summary> /// <param name="inputs">The inputs.</param> /// <param name="featureSet">The feature set.</param> /// <param name="priors">The priors.</param> /// <param name="results">The results.</param> /// <param name="mode">The mode.</param> /// <param name="showFactorGraph">if set to <c>true</c> [show factor graph].</param> public void Apply(Inputs inputs, FeatureSet featureSet, CommunityPriors priors, ref Results results, InputMode mode, bool showFactorGraph = false) { this.Engine.ShowFactorGraph = showFactorGraph; if (mode.HasFlag(InputMode.Validation)) { this.SetObservedValues(new[] { inputs.Validation.Instances }, featureSet, InputMode.Validation, priors); results.Validation = new Results.ResultsSet { IsRepliedTo = this.Engine.Infer <Bernoulli[][]>(this.RepliedTo)[0] }; } if (mode.HasFlag(InputMode.Testing)) { this.SetObservedValues(new[] { inputs.Test.Instances }, featureSet, InputMode.Testing, priors); results.Test = new Results.ResultsSet { IsRepliedTo = this.Engine.Infer <Bernoulli[][]>(this.RepliedTo)[0] }; } this.Engine.ShowFactorGraph = this.ShowFactorGraph; }