Browse Source

Add custom model

pull/1/head
rozetko 6 years ago
parent
commit
2fa7862f57
  1. 2
      analytics/detectors/pattern_detector.py
  2. 1
      analytics/models/__init__.py
  3. 17
      analytics/models/custom_model.py

2
analytics/detectors/pattern_detector.py

@ -23,6 +23,8 @@ def resolve_model_by_pattern(pattern: str) -> models.Model:
return models.StepModel()
if pattern == 'jump':
return models.JumpModel()
if pattern == 'custom':
return models.CustomModel()
raise ValueError('Unknown pattern "%s"' % pattern)

1
analytics/models/__init__.py

@ -2,3 +2,4 @@ from models.model import Model
from models.step_model import StepModel
from models.peaks_model import PeaksModel
from models.jump_model import JumpModel
from models.custom_model import CustomModel

17
analytics/models/custom_model.py

@ -0,0 +1,17 @@
from models import Model
import utils
# Paste your model here:
class CustomModel(Model):
def __init__(self):
super()
# Use self.state to store results of your learning
# It will be saved in filesystem and loaded after server restart
self.state = {}
async def fit(self, dataframe, segments):
pass
async def predict(self, dataframe):
return []
Loading…
Cancel
Save