watcher.decision_engine.scoring.dummy_scoring_container
Module¶watcher.decision_engine.scoring.dummy_scoring_container.
DummyScoringContainer
(config)[source]¶Bases: watcher.decision_engine.scoring.base.ScoringEngineContainer
Sample Scoring Engine container returning a list of scoring engines.
Please note that it can be used in dynamic scenarios and the returned list might return instances based on some external configuration (e.g. in database). In order for these scoring engines to become discoverable in Watcher API and Watcher CLI, a database re-sync is required. It can be executed using watcher-sync tool for example.
watcher.decision_engine.scoring.dummy_scoring_container.
SimpleFunctionScorer
(name, description, aggregate_function)[source]¶Bases: watcher.decision_engine.scoring.base.ScoringEngine
A simple generic scoring engine for demonstration purposes only.
A generic scoring engine implementation, which is expecting a JSON formatted array of numbers to be passed as an input for score calculation. It then executes the aggregate function on this array and returns an array with a single aggregated number (also JSON formatted).
calculate_score
(features)[source]¶Calculates a score value based on arguments passed.
Scoring Engines might be very different to each other. They might solve different problems or use different algorithms or frameworks internally. To enable this kind of flexibility, the method takes only one argument (string) and produces the results in the same format (string). The consumer of the Scoring Engine is ultimately responsible for providing the right arguments and parsing the result.
Parameters: | features (str) – Input data for Scoring Engine |
---|---|
Returns: | A score result |
Return type: | str |
get_description
()[source]¶Returns the description of the Scoring Engine.
The description might contain any human readable information, which might be useful for Strategy developers planning to use this Scoring Engine. It will be also visible in the Watcher API and CLI.
Returns: | A Scoring Engine description |
---|---|
Return type: | str |
get_metainfo
()[source]¶Returns the metadata information about Scoring Engine.
The metadata might contain a machine-friendly (e.g. in JSON format) information needed to use this Scoring Engine. For example, some Scoring Engines require to pass the array of features in particular order to be able to calculate the score value. This order can be defined in metadata and used in Strategy.
Returns: | A Scoring Engine metadata |
---|---|
Return type: | str |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.