The watcher.decision_engine.scoring.dummy_scorer
Module¶
-
class
watcher.decision_engine.scoring.dummy_scorer.
DummyScorer
(config)[source]¶ Bases:
watcher.decision_engine.scoring.base.ScoringEngine
Sample Scoring Engine implementing simplified workload classification.
Typically a scoring engine would be implemented using machine learning techniques. For example, for workload classification problem the solution could consist of the following steps:
- Define a problem to solve: we want to detect the workload on the machine based on the collected metrics like power consumption, temperature, CPU load, memory usage, disk usage, network usage, etc.
- The workloads could be predefined, e.g. IDLE, CPU-INTENSIVE, MEMORY-INTENSIVE, IO-BOUND, ... Or we could let the ML algorithm to find the workloads based on the learning data provided. The decision here leads to learning algorithm used (supervised vs. non-supervised learning).
- Collect metrics from sample servers (learning data).
- Define the analytical model, pick ML framework and algorithm.
- Apply learning data to the data model. Once taught, the data model becomes a scoring engine and can start doing predictions or classifications.
- Wrap up the scoring engine with the class like this one, so it has a standard interface and can be used inside Watcher.
This class is a greatly very simplified version of the above model. The goal is to provide an example how such class could be implemented and used in Watcher, without adding additional dependencies like machine learning frameworks (which can be quite heavy) or over-complicating it’s internal implementation, which can distract from looking at the overall picture.
That said, this class implements a workload classification “manually” (in plain python code) and is not intended to be used in production.
-
calculate_score
(features)[source]¶ Arbitrary algorithm calculating the score.
It demonstrates how to parse the input data (features) and serialize the results. It detects the workload type based on the metrics and also returns the probabilities of each workload detection (again, the arbitrary values are returned, just for demonstration how the “real” machine learning algorithm could work. For example, the Gradient Boosting Machine from H2O framework is using exactly the same format: http://www.h2o.ai/verticals/algos/gbm/