public void Sample() { #region Конфигурирование var adaptiveCompetitorModel = new NormalAdaptiveCompetitorModel { ErrorMeanFactor = 1, ErrorStddevFactor = 1, PlayerHistorySamples = new List<PlayerHistorySample> { new PlayerHistorySample { GameTitle = "Game" } } }; var mean = 1; var stddev = 1; var history = CreateHistory(mean, stddev, size: 1000); #endregion var newSamples = new List<double>(); for (var j = 0; j < 1000; j++) { var generator = new NormalAdaptiveCompetitorRandom(adaptiveCompetitorModel, history); newSamples.Add(generator.Sample()); } var newNormal = Normal.Estimate(newSamples); var newMean = newNormal.Mean; var newStddev = newNormal.StdDev; Assert.IsTrue(Math.Abs(newMean - mean) < 0.09); Assert.IsTrue(Math.Abs(newStddev - stddev) < 0.05); }
public void Sample2() { #region Конфигурирование var adaptiveCompetitorModel = new NormalAdaptiveCompetitorModel { ErrorMeanFactor = 0, ErrorStddevFactor = 0, PlayerHistorySamples = new List<PlayerHistorySample> { new PlayerHistorySample { GameTitle = "Game" } } }; var mean = 0; var stddev = 1; var history = CreateHistory(mean, stddev, size: 2); #endregion var newSamples = new List<double>(); var generator = new NormalAdaptiveCompetitorRandom(adaptiveCompetitorModel, history); Assert.AreEqual(generator.Sample(), 0); }
public NormalAdaptiveCompetitorRandom(NormalAdaptiveCompetitorModel model, ExperimentHistory history) { _model = model; _history = history; }