The watcher.decision_engine.scoring.base Module

The watcher.decision_engine.scoring.base Module

class watcher.decision_engine.scoring.base.ScoringEngine(config)[source]

Bases: watcher.common.loader.loadable.Loadable

A base class for all the Scoring Engines.

A Scoring Engine is an instance of a data model, to which the learning data was applied.

Please note that this class contains non-static and non-class methods by design, so that it’s easy to create multiple Scoring Engine instances using a single class (possibly configured differently).

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
classmethod get_config_opts()[source]

Defines the configuration options to be associated to this loadable

Returns:A list of configuration options relative to this Loadable
Return type:list of oslo_config.cfg.Opt instances
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
get_name()[source]

Returns the name of the Scoring Engine.

The name should be unique across all Scoring Engines.

Returns:A Scoring Engine name
Return type:str
class watcher.decision_engine.scoring.base.ScoringEngineContainer(config)[source]

Bases: watcher.common.loader.loadable.Loadable

A base class for all the Scoring Engines Containers.

A Scoring Engine Container is an abstraction which allows to plugin multiple Scoring Engines as a single Stevedore plugin. This enables some more advanced scenarios like dynamic reloading of Scoring Engine implementations without having to restart any Watcher services.

classmethod get_config_opts()[source]

Defines the configuration options to be associated to this loadable

Returns:A list of configuration options relative to this Loadable
Return type:list of oslo_config.cfg.Opt instances
classmethod get_scoring_engine_list()[source]

Returns a list of Scoring Engine instances.

Returns:A list of Scoring Engine instances
Return type:
class:~.scoring_engine.ScoringEngine
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.