ogd.core.generators.extractors package

Subpackages

Submodules

ogd.core.generators.extractors.Extractor module

class ogd.core.generators.extractors.Extractor.Extractor(params: GeneratorParameters)[source]

Bases: Generator

Base class for feature extractors.

In addition to event/feature filters and an update-from-event rule, the Feature base class requires subclasses to implement an update-from-feature rule and a calculate rule.

static AvailableModes() List[ExtractionMode][source]

List of ExtractionMode supported by the Feature.

Overridden from Extractor’s version of the function, only makes the Feature-related modes supported. :return: _description_ :rtype: List[ExtractionMode]

BaseFeatureSuffix() str[source]

Base function to add a suffix to the base feature name, which will not affect the naming of subfeatures. By default, returns “”; override to set a suffix. Example use-case: Suppose you want a feature that captures the number of times a player enters a given state, as well as the time spent in that state. The feature can be named “State”, with BaseFeatureSuffix returning “EntryCount” and a subfeature named “Time.” Then the columns will be named “StateEntryCount” and “StateTime.”

Returns:

_description_

Return type:

str

static FeatureDependencyModes() List[ExtractionMode][source]

List of ExtractionModes .

Overridden from Extractor’s version of the function, only makes the Feature-related modes supported. :return: _description_ :rtype: List[ExtractionMode]

GetFeatureNames() List[str][source]

Base function to get a list of names of the feature(s) a given Feature class outputs. By default, a Feature class just generates one value, and uses its own name (defined in the schema.json file). If Subfeatures was overridden, and returns a non-empty list, there will be additional feature names in the list this function returns. Each subfeature will have the base feature’s name as a prefix.

Returns:

[description]

Return type:

List[str]

GetFeatureValues() List[Any][source]
Subfeatures() List[str][source]

Base function to get a list of names of the sub-feature(s) a given Feature class outputs. By default, a Feature class has no subfeatures. However, if a Feature class is written to output multiple values, it will need to override this function to return an appropriate list. Note, Subfeatures must match the ordering from the override of GetFeatureNames, if returning a list of length > 0.

Returns:

A list of names of subfeatures for the Feature sub-class.

Return type:

Tuple[str]

ToFeatureData(player_id: str | None = None, sess_id: str | None = None) FeatureData[source]
UpdateFromEvent(event: Event)[source]

Overridden version of function from Extractor base class; In this case, set the “up to date” value to False whenever we see a new event.

Parameters:

event (Event) – _description_

UpdateFromFeatureData(feature: FeatureData)[source]

ogd.core.generators.extractors.Feature module

ogd.core.generators.extractors.PerCountFeature module

class ogd.core.generators.extractors.PerCountFeature.PerCountFeature(params: GeneratorParameters)[source]

Bases: Extractor

PerLevelFeature Abstract base class for per-level game features. Works like a normal Feature, but checks if the given event has right “level” before attempting to extract from event.

Args:

Feature (_type_): PerLevelFeature is a subclass of Feature

Returns:

_type_: _description_

property CountIndex: int[source]

ogd.core.generators.extractors.PerLevelFeature module

class ogd.core.generators.extractors.PerLevelFeature.PerLevelFeature(params: GeneratorParameters)[source]

Bases: PerCountFeature

Abstract base class for per-level game features. Works like a normal Feature, but checks if the given event has right “level” before attempting to extract from event.

Args:

Feature (_type_): PerLevelFeature is a subclass of Feature

Returns:

_type_: _description_

ogd.core.generators.extractors.SessionFeature module

class ogd.core.generators.extractors.SessionFeature.SessionFeature(params: GeneratorParameters)[source]

Bases: Extractor

Module contents