public void TestOnePref() { User user = GetUser("test", 1.0); PreferenceTransform2 zScore = new ZScore(); Assert.AreEqual(0.0, zScore.GetTransformedValue(user.GetPreferenceFor("0")), EPSILON); }
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); }
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); }
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); }
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 }); }
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 + ")"); }
protected override void Create() { plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Yellow)); zscore = new ZScore(this); length = 28; }
public void Bandwidth_increase_scenario() { var zScore = new ZScore(5, 2, 1); var values = new[]