public ActionResult JbSta() { ViewBag.IsBack = 0; if (Request["submit"] != null) { var user = Session["user"] as User; if (user != null) { int eid = user.Eid; DateTime begintime = Convert.ToDateTime(Request["sbegintime"]); DateTime endtime = Convert.ToDateTime(Request["sendtime"]); DataTable dt = SQLHelper.ProcDataTable("usp_StaJB", new SqlParameter("@eid", eid), new SqlParameter("@begintime", begintime), new SqlParameter("@endtime", endtime)); List <StatisticsList> stalist = new List <StatisticsList>(); foreach (DataRow row in dt.Rows) { stalist.Add(StatisticsList.DBDataToOStatisticsList(row, begintime, endtime)); } ViewBag.BeginTime = begintime.ToString("yyyy-MM-dd HH:mm"); ViewBag.EndTime = endtime.ToString("yyyy-MM-dd HH:mm"); ViewData.Model = stalist; } ViewBag.IsBack = 1; } return(PartialView()); }
public void ValidateGaussianStatisticsAsStatisticsList() { GaussianStatistics boolStat1 = GaussianStatistics.GetInstance(5, 2, 2); StatisticsList sList = boolStat1.AsStatisticsList(); Assert.AreEqual(1, sList.Count); }
private NoisyAdd(StatisticsList positiveAndNegativeStats) { //Helper.CheckCondition(positiveAndNegativeStats.Count > 0, "NoisyAdd with no nodes is kinda silly."); _predictorNodes = new List <TermSumNode>(positiveAndNegativeStats.Count); foreach (SufficientStatistics stat in positiveAndNegativeStats) { int sign = stat.AsDiscreteStatistics(); if (sign < 0) { _predictorNodes.Add(TermSumNode.GetNegativeInstance(0)); } else if (sign > 0) { _predictorNodes.Add(TermSumNode.GetPositiveInstance(0)); } else { _predictorNodes.Add(TermSumNode.GetNullInstance()); } } if (_predictorNodes.Count == 1) { _rootSumNode = _predictorNodes[0]; } else if (_predictorNodes.Count > 1) { _rootSumNode = new SumNode(_predictorNodes[0], _predictorNodes[1]); for (int i = 2; i < _predictorNodes.Count; i++) { _rootSumNode = new SumNode(_predictorNodes[i], _rootSumNode); } } }
public void ValidateMissingStatisticsAsStatisticsList() { MissingStatistics boolStat1 = MissingStatistics.GetInstance; StatisticsList sList = boolStat1.AsStatisticsList(); Assert.AreEqual(1, sList.Count); }
public void ValidateDiscreteStatisticsAsStatisticsList() { DiscreteStatistics boolStat1 = DiscreteStatistics.GetInstance(5); StatisticsList dStat = boolStat1.AsStatisticsList(); Assert.AreEqual(boolStat1, dStat.AsDiscreteStatistics()); }
public void ValidateContinuousStatisticsAsStatisticsList() { ContinuousStatistics boolStat1 = ContinuousStatistics.GetInstance(5); StatisticsList dStat = boolStat1.AsStatisticsList(); Assert.AreEqual(boolStat1, dStat.AsContinuousStatistics()); }
public void ValidateBooleanStatisticsAsStatisticsList() { BooleanStatistics boolStat1 = BooleanStatistics.GetInstance(true); StatisticsList sList = boolStat1.AsStatisticsList(); Assert.AreEqual(1, sList.Count); }
public string GetStatsForPrint() { StringBuilder builder = new StringBuilder(); //General stats builder.Append("=================" + name + "===============\n"); builder.Append("Average Elapsed Time: ").Append(AverageTimeElapsed).Append("\n"); builder.Append(" - For Correct Ones: ").Append(AverageTimeElapsedForCorrectOnes).Append("\n"); builder.Append(" - For Correctly Colored Ones: ").Append(AverageTimeElapsedForCorrectOnesWithCorrectlyColored).Append("\n"); builder.Append(" - For Incorrectly Colored Ones: ").Append(AverageTimeElapsedForCorrectOnesWithIncorrectlyColored).Append("\n"); builder.Append(" - For Incorrect Ones: ").Append(AverageTimeElapsedForIncorrectOnes).Append("\n"); builder.Append(" - For Correctly Colored Ones: ").Append(AverageTimeElapsedForIncorrectOnesWithCorrectlyColored).Append("\n"); builder.Append(" - For Incorrectly Colored Ones: ").Append(AverageTimeElapsedForIncorrectOnesWithIncorrectlyColored).Append("\n"); builder.Append("Total: ").Append(Total).Append("\n"); builder.Append(" - For Correct Ones: ").Append(TotalCorrect).Append("\n"); builder.Append(" - For Correctly Colored Ones: ").Append(TotalCorrectWithCorrectlyColored).Append("\n"); builder.Append(" - For Incorrectly Colored Ones: ").Append(TotalCorrectWithIncorrectlyColored).Append("\n"); builder.Append(" - For Incorrect Ones: ").Append(TotalIncorrect).Append("\n"); builder.Append(" - For Correctly Colored Ones: ").Append(TotalIncorrectWithCorrectlyColored).Append("\n"); builder.Append(" - For Incorrectly Colored Ones: ").Append(TotalIncorrectWithIncorrectlyColored).Append("\n"); builder.Append("Total Missed: ").Append(TotalMissed).Append("\n"); builder.Append(" - For Correctly Colored Ones: ").Append(TotalMissedWithCorrectlyColored).Append("\n"); builder.Append(" - For Incorrectly Colored Ones: ").Append(TotalMissedWithIncorrectlyColored).Append("\n"); builder.Append("=============================================\n"); //stats per guess StatisticsList.ForEach(stat => { builder.Append("=============================================\n"); if (!stat.Missed) { builder.Append("Time Elapsed: ").Append(stat.TimeElapsed).Append("\n"); } else { builder.Append("Missed\n"); } builder.Append("Card ").Append(stat.UseCorrectColor ? "(Correctly colored)" : "(Incorrectly Colored)").Append("\n"); Array.ForEach(stat.Card.cardEntities, cardEntity => { CardUtil.ColorEnum color = stat.EntityToColor[cardEntity.entity]; builder.Append(" - ").Append(color).Append(" ").Append(cardEntity.entity).Append("\n"); }); if (!stat.Missed) { builder.Append("Correct Guess?: ").Append(stat.CorrectEntity == stat.GuessedEntity).Append("\n"); builder.Append(" - Correct Entity: ").Append(stat.CorrectEntity).Append("\n"); builder.Append(" - Guessed Entity: ").Append(stat.GuessedEntity).Append("\n"); } else { builder.Append("Correct Entity: ").Append(stat.CorrectEntity).Append("\n"); } builder.Append("=============================================\n"); }); return(builder.ToString()); }
public static NoisyAdd GetInstance(StatisticsList positiveAndNegativeStats) { NoisyAdd noisyAdd = new NoisyAdd(positiveAndNegativeStats); //if (!_cachedStats.TryGetValue(positiveAndNegativeStats, out noisyAdd)) //{ // noisyAdd = new NoisyAdd(positiveAndNegativeStats); // _cachedStats.Add(positiveAndNegativeStats, noisyAdd); //} return(noisyAdd); }
public void ValidateStatisticsListGetHashCode() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); Assert.AreEqual(-1032035030, statList.GetHashCode()); }
public void ValidateStatisticsListAsContinuousStatistics() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); ContinuousStatistics cStat = statList.AsContinuousStatistics(); Assert.IsTrue(cStat.IsMissing()); }
//Must be called after AddPickedCard public void AddMissed(CardUtil.EntityEnum correctEntity) { StatisticsList.Add(new StatisticsPoint(correctEntity, card, entityToColor, useCorrectColor)); TotalMissed++; if (useCorrectColor) { TotalMissedWithCorrectlyColored++; } else { TotalMissedWithIncorrectlyColored++; } }
public void ValidateStatisticsListGetInstance() { GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); StatisticsList statList = StatisticsList.GetInstance(gaussStat); statList.Add(discreteStat); SufficientStatistics result = null; foreach (SufficientStatistics stat in statList) { Assert.IsTrue(SufficientStatistics.TryParse(stat.ToString(), out result)); } }
public void ValidateStatisticsListAsBooleanStatistics() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); BooleanStatistics dStat = statList.AsBooleanStatistics(); Assert.AreEqual(statList, dStat.AsStatisticsList()); }
public void ValidateStatisticsListEquals() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); StatisticsList clone = (StatisticsList)statList.Clone(); Assert.IsTrue(statList.Equals(clone)); }
public void ValidateStatisticsListToString() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); string statString = statList.ToString(); Assert.AreEqual(gaussStat.ToString() + ";" + discreteStat.ToString() + ";" + missingStat.ToString(), statString); }
public void ValidateStatisticsListAdd() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); SufficientStatistics result = null; foreach (SufficientStatistics stat in statList) { Assert.IsTrue(SufficientStatistics.TryParse(stat.ToString(), out result)); } }
public void ValidateStatisticsListRemoveRangeAndRemove() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); statList.RemoveRange(3, 2); Assert.AreEqual(3, statList.Count); statList.Remove(2); Assert.AreEqual(2, statList.Count); }
public void ValidateStatisticsListTryParse() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); SufficientStatistics result = null; StatisticsList statListSubSequence = (StatisticsList)statList.SubSequence(0, 2); Assert.IsTrue(StatisticsList.TryParse(statList.ToString(), out result)); Assert.IsTrue(StatisticsList.TryParse(statListSubSequence.ToString(), out result)); }
//Must be called after AddPickedCard public float AddGuess(float endTime, CardUtil.EntityEnum correctEntity, CardUtil.EntityEnum guessedEntity) { float timeElapsed = endTime - startTime; StatisticsList.Add(new StatisticsPoint(timeElapsed, correctEntity, guessedEntity, card, entityToColor, useCorrectColor)); Total++; AverageTimeElapsed = (AverageTimeElapsed * (Total - 1) + timeElapsed) / Total; if (correctEntity == guessedEntity) { TotalCorrect++; AverageTimeElapsedForCorrectOnes = (AverageTimeElapsedForCorrectOnes * (TotalCorrect - 1) + timeElapsed) / TotalCorrect; if (useCorrectColor) { TotalCorrectWithCorrectlyColored++; AverageTimeElapsedForCorrectOnesWithCorrectlyColored = (AverageTimeElapsedForCorrectOnesWithCorrectlyColored * (TotalCorrectWithCorrectlyColored - 1) + timeElapsed) / TotalCorrectWithCorrectlyColored; } else { TotalCorrectWithIncorrectlyColored++; AverageTimeElapsedForCorrectOnesWithIncorrectlyColored = (AverageTimeElapsedForCorrectOnesWithIncorrectlyColored * (TotalCorrectWithIncorrectlyColored - 1) + timeElapsed) / TotalCorrectWithIncorrectlyColored; } } else { TotalIncorrect++; AverageTimeElapsedForIncorrectOnes = (AverageTimeElapsedForIncorrectOnes * (TotalIncorrect - 1) + timeElapsed) / TotalIncorrect; if (useCorrectColor) { TotalIncorrectWithCorrectlyColored++; AverageTimeElapsedForIncorrectOnesWithCorrectlyColored = (AverageTimeElapsedForIncorrectOnesWithCorrectlyColored * (TotalIncorrectWithCorrectlyColored - 1) + timeElapsed) / TotalIncorrectWithCorrectlyColored; } else { TotalIncorrectWithIncorrectlyColored++; AverageTimeElapsedForIncorrectOnesWithIncorrectlyColored = (AverageTimeElapsedForIncorrectOnesWithIncorrectlyColored * (TotalIncorrectWithIncorrectlyColored - 1) + timeElapsed) / TotalIncorrectWithIncorrectlyColored; } } return(timeElapsed); }
private void LoadStatList() { _statList = new StatisticsList(_stats, _var); }
public void ValidateStatisticsListGetMissingInstance() { StatisticsList statList = StatisticsList.GetMissingInstance; Assert.IsTrue(statList.ElementAt(0).IsMissing()); }
public static async Task LoadStatisticsList() { StatisticsList = await TrackerService.getInformation(); }
public void ValidateStatisticsListSubSequence() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); SufficientStatistics result = null; StatisticsList statListSubSequence = (StatisticsList)statList.SubSequence(0, 2); Assert.IsTrue(GaussianStatistics.TryParse(statListSubSequence.ElementAt(0).ToString(), out result)); Assert.IsTrue(DiscreteStatistics.TryParse(statListSubSequence.ElementAt(1).ToString(), out result)); }