stroo/main.py

22 lines
494 B
Python
Raw Normal View History

2021-09-19 14:38:23 +02:00
2021-09-19 14:44:26 +02:00
#data loading
import numpy as np
2021-09-19 14:38:23 +02:00
f=np.load("useragents.npz")
2021-09-19 14:44:26 +02:00
from stroo import train_model
#understands pure strings
#definitely not the best possible model
#so if this is at least >0.55 (on more complicated data) we should be able to do something with it
#also migth be included into an isolation forest
model=train_model(f["train"],n=3)
2021-09-19 14:38:23 +02:00
2021-09-19 14:44:26 +02:00
#calculate auc. Has disparity between normal, abnormal: np.mean(testy)~=0.065
print(model.eval(f["testx"],f["testy"]))
#in my tests reaches >0.99
2021-09-19 14:38:23 +02:00