This function is only present in the core library version of CyborgDB. In other versions (microservice, serverless), it is automatically called once enough vector embeddings have been indexed.

Builds the index using the specified training configuration. Required before efficient querying. Prior to calling this, all queries will be conducted using encrypted exhaustive search. After, they will be conducted using encrypted ANN search.

void TrainIndex(const TrainingConfig& training_config = TrainingConfig());

Parameters

ParameterTypeDescription
training_configTrainingConfig(Optional) Training parameters (batch size, max iterations, etc.).
There must be at least 2 * n_lists vector embeddings in the index prior to to calling this function.

Exceptions

Throws if there are not enough vector embeddings in the index for training (must be at least 2 * n_lists).

Example Usage

cyborg::TrainingConfig config(128, 10, 1e-4, 1024);
index->TrainIndex(config);