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());
 }
Esempio n. 2
0
        public void ValidateGaussianStatisticsAsStatisticsList()
        {
            GaussianStatistics boolStat1 = GaussianStatistics.GetInstance(5, 2, 2);
            StatisticsList     sList     = boolStat1.AsStatisticsList();

            Assert.AreEqual(1, sList.Count);
        }
Esempio n. 3
0
        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);
                }
            }
        }
Esempio n. 4
0
        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());
        }
Esempio n. 6
0
        public void ValidateContinuousStatisticsAsStatisticsList()
        {
            ContinuousStatistics boolStat1 = ContinuousStatistics.GetInstance(5);
            StatisticsList       dStat     = boolStat1.AsStatisticsList();

            Assert.AreEqual(boolStat1, dStat.AsContinuousStatistics());
        }
Esempio n. 7
0
        public void ValidateBooleanStatisticsAsStatisticsList()
        {
            BooleanStatistics boolStat1 = BooleanStatistics.GetInstance(true);
            StatisticsList    sList     = boolStat1.AsStatisticsList();

            Assert.AreEqual(1, sList.Count);
        }
Esempio n. 8
0
    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());
    }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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());
        }
Esempio n. 11
0
        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());
        }
Esempio n. 12
0
    //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++;
        }
    }
Esempio n. 13
0
        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));
            }
        }
Esempio n. 14
0
        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());
        }
Esempio n. 15
0
        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));
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
 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));
     }
 }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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));
        }
Esempio n. 20
0
    //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);
 }
Esempio n. 22
0
        public void ValidateStatisticsListGetMissingInstance()
        {
            StatisticsList statList = StatisticsList.GetMissingInstance;

            Assert.IsTrue(statList.ElementAt(0).IsMissing());
        }
Esempio n. 23
0
 public static async Task LoadStatisticsList()
 {
     StatisticsList = await TrackerService.getInformation();
 }
Esempio n. 24
0
 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));
 }
Esempio n. 25
0
 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);
 }
Esempio n. 26
0
 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());
 }
Esempio n. 27
0
 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());
 }
Esempio n. 28
0
 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());
 }
Esempio n. 29
0
 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));
 }
Esempio n. 30
0
 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);
 }