Reference#

class Workspace(create_key, workspace: Workspace)#
classmethod create_from_config(config: Config) Workspace#
classmethod create_from_json_model(model_json: Dict[str, Any]) Workspace#
classmethod create_from_model(data: bytearray) Workspace#
create_parser(format_type: Literal[FormatType.VwText]) TextParser#
create_parser(format_type: Union[Literal[FormatType.DsJson], Literal[FormatType.Json]]) JsonParser
property entry_reduction_types: ReductionTypesDescription#
learn(features: Union[SparseFeatures, CbAdfFeatures], label: Union[SimpleLabel, CbLabel]) None#
predict(features: Union[SparseFeatures, CbAdfFeatures]) Union[ScalarPred, ActionScoresPred, ActionProbsPred]#
predict_then_learn(features: Union[SparseFeatures, CbAdfFeatures], label: Union[SimpleLabel, CbLabel]) Union[ScalarPred, ActionScoresPred, ActionProbsPred]#
serialize() bytearray#
serialize_to_json() Dict[str, Any]#
class JsonParser#
parse(input: Union[Dict[str, Any], str]) Tuple[Union[SparseFeatures, CbAdfFeatures], Optional[Union[SimpleLabel, CbLabel]]]#
class TextParser#
parse(input: str) Tuple[Union[SparseFeatures, CbAdfFeatures], Optional[Union[SimpleLabel, CbLabel]]]#
class ReductionTypesDescription(self, input_label_type: LabelType, output_prediction_type: PredictionType, input_features_type: FeaturesType, output_label_type: Optional[LabelType] = None, input_prediction_type: Optional[PredictionType] = None, output_features_type: Optional[FeaturesType] = None)#
input_features_type#

The features type expected as input for this reduction

Return type:

FeaturesType

input_label_type#

The label type expected as input for this reduction

Return type:

LabelType

input_prediction_type#

The prediction type expected as input for this reduction. If this is a base reduction, this will be None

Return type:

Optional[PredictionType]

output_features_type#

The features type expected as output for this reduction. If this is a base reduction, this will be None

Return type:

Optional[FeaturesType]

output_label_type#

The label type expected as output for this reduction. If this is a base reduction, this will be None

Return type:

Optional[LabelType]

output_prediction_type#

The prediction type expected as output for this reduction

Return type:

PredictionType

class FormatType#
DsJson = FormatType.DsJson#
Json = FormatType.Json#
VwText = FormatType.VwText#

Configuration#

class Config#

While this shows up as a class, it is actually a TypedDict. So it can be instantiated as a dict or as a class.

entryReduction: EntryReductionConfig#
globalConfig: GlobalConfig#
class GlobalConfig#

While this shows up as a class, it is actually a TypedDict. So it can be instantiated as a dict or as a class.

constantFeatureEnabled: NotRequired[bool]#
hashSeed: NotRequired[int]#
interactions: NotRequired[List[Union[Literal['Default'], NameInteraction]]]#
numBits: NotRequired[int]#
class EntryReductionConfig#

While this shows up as a class, it is actually a TypedDict. So it can be instantiated as a dict or as a class.

config: NotRequired[Dict[str, Any]]#
typename: str#
Interaction#

alias of Union[Literal[‘Default’], NameInteraction]

class NameInteraction#
name: str#

Labels#

class LabelType#

Type of label

Binary = LabelType.Binary#
CB = LabelType.CB#
Simple = LabelType.Simple#
class SimpleLabel(value: float, weight: float = 1.0)#
Parameters:
  • value (float) – Label value

  • weight (float) – Label weight

value#

The label’s value

Return type:

float

weight#

Weight of example to be used in update

Return type:

float

class CbLabel(action: int, cost: float, probability: float)#
Parameters:
  • action (int) – Chosen action (zero based)

  • cost (float) – Cost of chosen action

  • probability (float) – Probability of chosen action

action#

The label’s action

Return type:

int

cost#

The label’s cost

Return type:

float

probability#

The label’s probability

Return type:

float

Predictions#

class PredictionType#

Type of prediction

ActionProbs = PredictionType.ActionProbs#
ActionScores = PredictionType.ActionScores#
Binary = PredictionType.Binary#
Scalar = PredictionType.Scalar#
class ScalarPred(prediction: float, raw_prediction: float)#
Parameters:
  • prediction (float) – Prediction value (including clamping by the seen range and link function)

  • raw_prediction (float) – Raw prediction value

prediction#
raw_prediction#
class ActionScoresPred(value: List[Tuple[int, float]])#
Parameters:

value – A list of tuples of the form (action, score)

value#
class ActionProbsPred(value: List[Tuple[int, float]])#
Parameters:

value – A list of tuples of the form (action, probability)

value#

Features#

class FeaturesType#

Type of features

SparseCbAdf = FeaturesType.SparseCbAdf#
SparseSimple = FeaturesType.SparseSimple#
class CbAdfFeatures#
class SparseFeatures#
class typing_extensions.NotRequired#

See typing_extensions.NotRequired