public static void Persist() { var db = DB.NewContext; DCC.Persist(db); AxesBuilder.Persist(db); db.SaveChanges(); }
public static void Refresh() { OfflineDB.RefreshFromDB(); ProfileMaintainer.ComputeDayWeights(); DCC.Refresh(); AxesBuilder.UpdateOrigin(); ProfileMaintainer.Refresh(); }
public static void AddTuple(DataSetTuple dataSetTuple) { if (!IsActive) { StoneBaseChanel.ForwardToServer(dataSetTuple); return; } int groupNumber = AxesBuilder.GroupFunction(dataSetTuple.StoneFeatures); if (groupNumber == 0) { GroupChanels[0].Add(dataSetTuple); } else { var clusters = ProfileMaintainer.AcquaintanceList.Where(x => x.Prefix == dataSetTuple.ClusterPrefix); if (clusters.Count() > 0) { Boolean added = false; var cluster = clusters.First(); foreach (var group in DCC.Groups) { var probability = cluster.ProbabilityInGroup(group); var chanel = GroupChanels[group.Number]; added = chanel.ProbabilisticAdd(dataSetTuple, probability * chanel.Capacity); if (added) { break; } } if (!added) { SuspiciousChanel.Add(dataSetTuple); } } else { SuspiciousChanel.Add(dataSetTuple); } } }
public static void Receive(DataAggregatorTuple daTuple) { int newGroupIndex = AxesBuilder.GroupFunction(daTuple.NewFeatures); int oldGroupIndex = AxesBuilder.GroupFunction(daTuple.OldFeatures); if (newGroupIndex != oldGroupIndex) { if (daTuple.NewFeatures.HasValue) { if (newGroupIndex != 0) { Groups[newGroupIndex].AddCluster(daTuple.SourceCluster); } } if (daTuple.OldFeatures.HasValue && Groups[oldGroupIndex].Clusters.Count > 0) { if (oldGroupIndex != 0) { Groups[oldGroupIndex].RemoveCluster(daTuple.SourceCluster); } } } int sumRatio = Groups.Sum(x => x.Clusters.Count); foreach (var group in Groups) { group.Rc = (double)group.Clusters.Count / sumRatio; } for (int i = 0; i < 8; i++) { if (Math.Abs(Groups[i].Rc - Groups[i].Re) > ApplicationSettings.Instance.AlarmTolerance) { Alarm(i, Groups[i].Rc, Groups[i].Re, ApplicationSettings.Instance.AlarmTolerance); } } AxesBuilder.Add(daTuple.SourceCluster); }