Skip to content

Train

Train a model with the given parameters.

Parameters:

Name Type Description Default
task_type NLPTask

The type of task to train for.

required
model_type ModelType

The type of model to train.

required
dataset_name str

The name of the dataset.

required
multi_column_roots list[str] | None

A list of column roots.

required
input_text_col_index int

The index of the input text column.

required
document_files list[str] | None

List of paths to document files, if any.

None

Returns:

Name Type Description
dict Dict[str, Any]

The API response for the training request.

Example Usage

from anote import NLPTask, ModelType

task_type = NLPTask.TEXT_CLASSIFICATION
model_type = ModelType.NAIVE_BAYES_TEXT_CLASSIFICATION
dataset_name = "your_dataset"
multi_column_roots = ["root1", "root2"]
input_text_col_index = 0

model_id = anote.train(
    task_type=task_type,
    model_type=model_type,
    dataset_name=dataset_name,
    multi_column_roots=multi_column_roots,
    input_text_col_index=input_text_col_index
)
print(f"Model trained successfully with ID: {model_id}")