Browse Source

move supervised_algorithm.py -> detectors/general_detector/ folder

pull/1/head
Alexey Velikiy 6 years ago
parent
commit
6f8ca9337a
  1. 1
      analytics/detectors/general_detector/__init__.py
  2. 5
      analytics/detectors/general_detector/general_detector.py
  3. 4
      analytics/detectors/general_detector/supervised_algorithm.py

1
analytics/detectors/general_detector/__init__.py

@ -0,0 +1 @@
from detectors.general_detector.general_detector import GeneralDetector

5
analytics/detectors/general_detector.py → analytics/detectors/general_detector/general_detector.py

@ -1,3 +1,4 @@
from detectors.general_detector.supervised_algorithm import SupervisedAlgorithm
import utils import utils
from grafana_data_provider import GrafanaDataProvider from grafana_data_provider import GrafanaDataProvider
from data_preprocessor import data_preprocessor from data_preprocessor import data_preprocessor
@ -9,6 +10,7 @@ import os.path
import json import json
NANOSECONDS_IN_MS = 1000000 NANOSECONDS_IN_MS = 1000000
logger = logging.getLogger('analytic_toolset') logger = logging.getLogger('analytic_toolset')
@ -120,8 +122,7 @@ class GeneralDetector:
return json.load(file) return json.load(file)
def create_algorithm(self): def create_algorithm(self):
from supervised_algorithm import supervised_algorithm return SupervisedAlgorithm()
return supervised_algorithm()
def __save_model(self): def __save_model(self):
logger.info("Save model '%s'" % self.anomaly_name) logger.info("Save model '%s'" % self.anomaly_name)

4
analytics/supervised_algorithm.py → analytics/detectors/general_detector/supervised_algorithm.py

@ -4,10 +4,8 @@ from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import IsolationForest from sklearn.ensemble import IsolationForest
import pandas as pd import pandas as pd
from sklearn import svm
class SupervisedAlgorithm(object):
class supervised_algorithm(object):
frame_size = 16 frame_size = 16
good_features = [ good_features = [
#"value__agg_linear_trend__f_agg_\"max\"__chunk_len_5__attr_\"intercept\"", #"value__agg_linear_trend__f_agg_\"max\"__chunk_len_5__attr_\"intercept\"",
Loading…
Cancel
Save