Steve L. Nyemba 8 years ago
commit aaa6cf9a08

@ -139,29 +139,35 @@ def learn():
gReader = factory.instance(type=class_read,args=p)
d = gReader.read()
if 'learn' in d :
logs = d['learn']
info = d['learn']
del d['learn']
else :
logs = []
info = []
r = []
if 'id' in request.args:
id = request.args['id']
d = d[id]
print CONFIG['monitor']['processes']['config'][id]
print (apps)
apps = CONFIG['monitor']['processes']['config'][id]
#print (apps)
params = {}
for item in info:
id = item['label']
params[id] = item
#apps = list(set(ML.Extract(['label'],d)))
p = AnomalyDetection()
#for row in d :
#xo = ML.Filter('label',app,d)
for name in apps :
xo = ML.Filter('label',name,d)
_info = params[name]
#info = ML.Filter('label',app,logs)
#value = p.predict(xo,info)
value = p.predict(xo,_info)
print [row[1] for row in value]
break
#print app,value
#if value is not None:
# r.append(value)
print r
return json.dumps("[]")
return json.dumps([])

@ -116,14 +116,16 @@ class AnomalyDetection:
@param info stored information about this
"""
def predict(self,xo,info):
xo = ML.Filter(info['extract'],xo)
xo = ML.Extract(info['features'],xo)
if not xo :
return None
sigma = info['parameters']['cov']
xu = info['parameters']['mean']
epsilon = info['performance']['epsilon']
return self.getPx(xu,sigma,xo,epsilon)
return self.gPx(xu,sigma,xo,epsilon)
"""
This function computes performance metrics i.e precision, recall and f-score
for details visit https://en.wikipedia.org/wiki/Precision_and_recall

@ -177,6 +177,7 @@ class ThreadManager:
class Factory :
"""
This function will return an instance of an object in the specified in the configuration file

Loading…
Cancel
Save