-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHybridAnomalyDetector.cpp
More file actions
60 lines (51 loc) · 1.75 KB
/
Copy pathHybridAnomalyDetector.cpp
File metadata and controls
60 lines (51 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Hod Amar and Ofek Avergil
//
#include "HybridAnomalyDetector.h"
#include "minCircle.h"
// Auto-generated constructor stub
HybridAnomalyDetector::HybridAnomalyDetector() {
this->circThreshold = 0.5;
}
/**
* if the corr is linear finds lin_reg and threshold, if the corr is circular finds the reg_circ
* @param couple - correlated-features object
* @param array - array of pointer to points
* @param size - the size of the array;
*/
void HybridAnomalyDetector:: fillCorr(correlatedFeatures* couple, Point** array, size_t size) {
// if the corr is linear, move to the simple detector fill func.
if (couple->corrlation >= this->linThreshold) {
this->SimpleAnomalyDetector::fillCorr(couple,array,size);
} else{
//if the corr is circular, find the circ reg
couple->circ_reg = findMinCircle(array,size);
couple->isCirc = true;
}
}
/**
* check if there is anomaly in point p of a correlated couple
* @param couple - correlated-features object
* @param p - the checked point
* @return True is there is an anomaly, false otherwise.
*/
bool HybridAnomalyDetector:: detectCorr(correlatedFeatures couple, Point *p ) {
if (couple.isCirc) {
Circle bigger = couple.circ_reg;
bigger.radius = bigger.radius * 1.1;
return (!isInside(bigger, *p));
} else {
return this->SimpleAnomalyDetector::detectCorr(couple, p);
}
}
// Auto-generated destructor stub
HybridAnomalyDetector:: ~HybridAnomalyDetector() {
}
/**
* checks if the correlation is over the minimum threshold
* @param corr - the check correlated
* @return - true if the correlation is big enough, false otherwise.
*/
bool HybridAnomalyDetector::checkIfCorr(float corr) {
return (abs(corr) >= this->circThreshold);
}