示例#1
0
        public void TestOnePref()
        {
            User user = GetUser("test", 1.0);
            PreferenceTransform2 zScore = new ZScore();

            Assert.AreEqual(0.0, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
        }
示例#2
0
 public SnmpTrafficRateValueFilter(decimal pollIntervalSeconds)
 {
     // These numbers have been picked carefully to try to catch the SNMP double-interval-read spike
     // which happens due to the counters getting updated twice during the imprecise poll interval
     // while also not discarding real traffic spikes or rate adjustments due to throttling.
     this._zScore = new ZScore(Math.Max(4 - (int)pollIntervalSeconds, 2), 2, 1);
 }
示例#3
0
 public void TestStdev()
 {
     User user = GetUser("test", -1.0, -2.0);
     PreferenceTransform2 zScore = new ZScore();
     Assert.AreEqual(0.707107, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
     Assert.AreEqual(-0.707107, zScore.GetTransformedValue(user.GetPreferenceFor("1")), EPSILON);
 }
示例#4
0
        public void TestStdev()
        {
            User user = GetUser("test", -1.0, -2.0);
            PreferenceTransform2 zScore = new ZScore();

            Assert.AreEqual(0.707107, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
            Assert.AreEqual(-0.707107, zScore.GetTransformedValue(user.GetPreferenceFor("1")), EPSILON);
        }
示例#5
0
 public void TestExample()
 {
     User user = GetUser("test", 5.0, 7.0, 9.0);
     PreferenceTransform2 zScore = new ZScore();
     Assert.AreEqual(-1.0, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
     Assert.AreEqual(0.0, zScore.GetTransformedValue(user.GetPreferenceFor("1")), EPSILON);
     Assert.AreEqual(1.0, zScore.GetTransformedValue(user.GetPreferenceFor("2")), EPSILON);
 }
示例#6
0
        public void TestExample()
        {
            User user = GetUser("test", 5.0, 7.0, 9.0);
            PreferenceTransform2 zScore = new ZScore();

            Assert.AreEqual(-1.0, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
            Assert.AreEqual(0.0, zScore.GetTransformedValue(user.GetPreferenceFor("1")), EPSILON);
            Assert.AreEqual(1.0, zScore.GetTransformedValue(user.GetPreferenceFor("2")), EPSILON);
        }
示例#7
0
        public List <string> AsString()
        {
            string value;
            string zscore;
            int    rounding;

            if (Empty)
            {
                return(new List <string> {
                    Name,
                    "",
                    "",
                    ""
                });
            }

            if (UnitShorthand.Equals("mmHg") ||
                UnitShorthand.Equals("cm/s") ||
                UnitShorthand.Equals("m/s"))
            {
                rounding = 1;
            }
            else
            {
                rounding = 2;
            }
            value = Math.Round(Value, rounding).ToString();

            if (ZScoreable)
            {
                zscore = ZScore.ToString("N2");
            }
            else
            {
                zscore = "";
            }

            return(new List <string> {
                Name,
                value,
                UnitShorthand,
                zscore
            });
        }
示例#8
0
        public string ReportString(bool includeZScore = true, bool includeComment = true)
        {
            string name;
            string value;
            string Zscorestring = "";

            if (HasComment && includeComment)
            {
                if (AnomalyText.Length == 0)
                {
                    return("");
                }
                name = AnomalyText;
            }
            else
            {
                name = Name;
            }

            if (UnitShorthand.Equals("mmHg") ||
                UnitShorthand.Equals("cm/s") ||
                UnitShorthand.Equals("m/s"))
            {
                value = Math.Round(Value, 1).ToString();
            }
            else
            {
                value = Math.Round(Value, 2).ToString();
            }

            if (ZScoreable && includeZScore)
            {
                Zscorestring = ", Z-score=" + ZScore.ToString("N2");
            }
            return(name + " (" + value + " " + UnitShorthand + Zscorestring + ")");
        }
示例#9
0
 protected override void Create()
 {
     plot1  = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Yellow));
     zscore = new ZScore(this);
     length = 28;
 }
示例#10
0
 public void TestOnePref()
 {
     User user = GetUser("test", 1.0);
     PreferenceTransform2 zScore = new ZScore();
     Assert.AreEqual(0.0, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON);
 }
示例#11
0
 public void Bandwidth_increase_scenario()
 {
     var zScore = new ZScore(5, 2, 1);
     var values = new[]