Docs /Templates/ sinapsis-vowpal-wabbit

CBExploreADFLearnEmbeddings

sinapsis-vowpal-wabbitcommunity

Python template · sinapsis_vowpal_wabbit.templates.cb_explore_adf_learn_embeddings

Overview

Template to perform action learning using the Vowpal Wabbit CB_Explore_ADF approach.

Uses text instructions and action labels, enhanced with sentence embeddings.

Attributes: actions (list[str]): List of available actions for the contextual bandit. vw_workspace_params (CBExploreADFWorkspaceParams): Workspace parameters specific to the CB explore-adf algorithm. Defaults to an empty CBExploreADFWorkspaceParams instance if not provided or if an empty dict is passed. remove_stop_words (bool): Flag indicating whether to remove stop words from text. Defaults to False. remove_special_characters (bool): Flag indicating whether to remove special characters from text. Defaults to True. epochs (int): Number of training epochs. Defaults to 5. instruction_column (str): Name of the column containing instructions or features. true_action_column (str): Name of the column containing the true/correct actions. split_dataset (bool): Whether to split the dataset into train and test sets. Defaults to True. train_test_split_params (TrainTestSplitParams): Parameters for train-test split configuration. Defaults to an empty dictionary via factory. root_dir (str): Root directory path for model storage. save_path (str): Relative path within root_dir where the model will be saved. full_save_path (str): Computed property that combines root_dir and save_path into a single absolute file system path. sentence_transformer_params (SentenceTransformerParams): Configuration parameters for the SentenceTransformer model used to generate embeddings from text. Defaults to an empty SentenceTransformerParams instance if not provided or if an empty dict is passed.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-vowpal-wabbit==1.0.0
uv pip install sinapsis-vowpal-wabbit==1.0.0
uv add sinapsis-vowpal-wabbit==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

epochs

Number of training epochs. Defaults to 5.

int
Optional
Default: 5
actionsRequired
list[str]
Required
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
root_dir

Root directory path for model storage.

str
Optional
Default: "/home/ariel/.cache/sinapsis"
save_path

Relative path within root_dir where the model will be saved. full_save_path (str): Computed property that combines root_dir and save_path into a single absolute file system path.

str
Optional
Default: "cb_explore_adf_model.vw"
stop_words
list
Optional
Default: ["i","me","my","myself","we","our","ours","ourselves","you","you're","your","yours","yourself","yourselves","he","him","his","himself","she","her","hers","herself","it","its","itself","they","them","their","theirs","themselves","what","which","who","whom","this","that","these","those","am","is","are","was","were","be","been","being","have","has","had","having","do","does","did","doing","a","an","the","and","but","if","or","because","as","until","while","of","at","by","for","with","about","against","between","into","through","during","before","after","above","below","to","from","up","down","in","out","on","off","over","under","again","further","then","once","here","there","when","where","why","how"]
random_seed
int | None
Optional
Default: null
split_dataset

Whether to split the dataset into train and test sets. Defaults to True.

bool
Optional
Default: true
remove_stop_words
bool
Optional
Default: false
clean_text_pattern
str
Optional
Default: "[^a-z0-9\\s]"
instruction_columnRequired

Name of the column containing instructions or features.

str
Required
Default: null
true_action_columnRequired

Name of the column containing the true/correct actions.

str
Required
Default: null
vw_workspace_params
CBExploreADFWorkspaceParams
Optional
Default: null
l1
float
Optional
Default: 0
l2
float
Optional
Default: 0
quiet
Whether to suppress output. Defaults to False. Raises: ValueError: If exploration_value is inconsistent with exploration_method: - If method is "first" or "bag" but value is not an integer - If method is "epsilon" but… Read full field description

Whether to suppress output. Defaults to False. Raises: ValueError: If exploration_value is inconsistent with exploration_method: - If method is "first" or "bag" but value is not an integer - If method is "epsilon" but value is not a float or outside [0.0, 1.0] Properties: vw_exploration_string: Generates the corresponding Vowpal Wabbit command line arguments for the configured exploration method and value.

bool
Optional
Default: false
adaptive

Whether to use adaptive exploration. Defaults to True.

bool
Optional
Default: true
ngram_size
int
Optional
Default: 2
normalized

Whether to use normalized weights. Defaults to True.

bool
Optional
Default: true
bit_precision
int
Optional
Default: 24
learning_rate
float | None
Optional
Default: null
ngram_namespaces
list[str]
Optional
Default: []
exploration_value

The value parameter for the chosen exploration method. - For "first" and "bag": Must be an integer (e.g., number of actions to explore) - For "epsilon": Must be a float between 0.0 and 1.0 (exploration probability) - For "softmax": Must be a float (lambda/temperature parameter) Defaults to 0.2.

int | float
Optional
Default: 0.2
cubic_interactions
list[str]
Optional
Default: []
exploration_method

The exploration strategy to use. Options are: - "first": Explores the first action - "epsilon": Epsilon-greedy exploration - "bag": Bagging/bootstrap exploration - "softmax": Softmax exploration with temperature parameter Defaults to "epsilon".

typing.Literal['first', 'epsilon', 'bag', 'softmax']
Optional
Default: "epsilon"
quadratic_interactions
list[str]
Optional
Default: []
train_test_split_params

Parameters for train-test split configuration. Defaults to an empty dictionary via factory.

TrainTestSplitParams
Optional
Default: null
shuffle
bool
Optional
Default: true
test_size
float | None
Optional
Default: null
train_size
float | None
Optional
Default: null
remove_special_characters
bool
Optional
Default: true
sentence_transformer_params

Configuration parameters for the SentenceTransformer model used to generate embeddings from text. Defaults to an empty SentenceTransformerParams instance if not provided or if an empty dict is passed.

SentenceTransformerParams
Optional
Default: null
device
str
Optional
Default: "cuda:0"
precision
typing.Literal['float32', 'int8', 'uint8', 'binary', 'ubinary']
Optional
Default: "float32"
batch_size
int
Optional
Default: 32
model_name
str
Optional
Default: "all-MiniLM-L6-v2"
normalize_embeddings
bool
Optional
Default: true

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
templates:
  - template_name: "CBExploreADFLearnEmbeddings"
    class_name: "CBExploreADFLearnEmbeddings"
    attributes:
      epochs: 5
      actions: "<required>"
      root_dir: "/home/ariel/.cache/sinapsis"
      save_path: "cb_explore_adf_model.vw"
      stop_words: {}
      random_seed: null
      split_dataset: true
      remove_stop_words: false
      clean_text_pattern: "[^a-z0-9\\s]"
      instruction_column: "<required>"
      true_action_column: "<required>"
      vw_workspace_params:
        l1: 0
        l2: 0
        quiet: false
        adaptive: true
        ngram_size: 2
        normalized: true
        bit_precision: 24
        learning_rate: null
        ngram_namespaces: []
        exploration_value: 0.2
        cubic_interactions: []
        exploration_method: "epsilon"
        quadratic_interactions: []
      train_test_split_params:
        shuffle: true
        test_size: null
        train_size: null
      remove_special_characters: true
      sentence_transformer_params:
        device: "cuda:0"
        precision: "float32"
        batch_size: 32
        model_name: "all-MiniLM-L6-v2"
        normalize_embeddings: true

Inheritance

Immediate parent: sinapsis_vowpal_wabbit.templates.cb_explore_adf_learn.CBExploreADFLearn

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.