public PropertyModel Statistics(PropertyModel property, Double[] original, Double[] predicted) { int length = (predicted.Length <= original.Length) ? predicted.Length : original.Length; double[] dist = new double[length]; if (length == 0) return null; else { int count = 0; for (int i = 0; i < length; i++) { dist[i] = Math.Abs(original[i] - predicted[i]); if (dist[i] <= property.Threshold) count++; i++; } property.Minimum = dist.Min(); property.Maximum = dist.Max(); property.Average = dist.Sum() / length; property.Accuracy = (double)count * 100 / length; return property; } }
public PropertyModel(PropertyModel p) { KNN = p.KNN; Exponent = p.Exponent; Threshold = p.Threshold; Accuracy = p.Accuracy; Average = p.Average; Maximum = p.Maximum; Minimum = p.Minimum; }
public DeviceModel(DeviceModel d) { Id = d.Id; Mac = d.Mac; Name = d.Name; XLocation = d.XLocation; YLocation = d.YLocation; RSSValue = d.RSSValue; Property = new PropertyModel(d.Property); }
public DeviceModel() { RSSValue = new double[] { }; Property = new PropertyModel(); }
public void GetStatistics(Double[] a, Double[] b) { Property = new PropertyModel(WifiLocalization.Manager.Instance.GetStatistics(this.Property, a, b)); }
/// <summary> /// Uses PropertyModel.Thershold /// Takes List<LocationModel(){original,predicted}> /// </summary> /// <returns>PropertyModel Statistics : Acc%,Avg,Max,Min</returns> public PropertyModel GetStatistics(PropertyModel property, Double[] original, Double[] predicted) { return WifiLocalization.Implement.Instance.Statistics(property, original, predicted); }