Skip to content

Commit

Permalink
add example for custom metrics in feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski committed Jan 24, 2020
1 parent 87fe3f9 commit 519cc3b
Show file tree
Hide file tree
Showing 2 changed files with 552 additions and 140 deletions.
15 changes: 9 additions & 6 deletions examples/models/template_model_with_metrics/ModelWithMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ class ModelWithMetrics(object):
def __init__(self):
print("Initialising")

def predict(self,X,features_names):
def predict(self, X, features_names):
print("Predict called")
return X

def send_feedback(self, features, feature_names, reward, truth, routing=None):
print("Send feedback called")
return []

def metrics(self):
return [
{"type":"COUNTER","key":"mycounter","value":1}, # a counter which will increase by the given value
{"type":"GAUGE","key":"mygauge","value":100}, # a gauge which will be set to given value
{"type":"TIMER","key":"mytimer","value":20.2}, # a timer which will add sum and count metrics - assumed millisecs
]

{"type": "COUNTER", "key": "mycounter", "value": 1}, # a counter which will increase by the given value
{"type": "GAUGE", "key": "mygauge", "value": 100}, # a gauge which will be set to given value
{"type": "TIMER", "key": "mytimer", "value": 20.2}, # a timer which will add sum and count metrics - assumed millisecs
]
Loading

0 comments on commit 519cc3b

Please sign in to comment.