Skip to content

Train

Train a model with the given parameters.

Parameters:

Name Type Description Default
task_type str

The type of task (e.g., classification, regression).

required
model_type str

The type of model to train.

required
dataset_name str

The name of the dataset.

required
multi_column_roots list

A list of column roots.

required
input_text_col_index int

The index of the input text column.

required
document_files list

List of paths to document files, if any.

None

Returns:

Name Type Description
str

The model ID if training is successful.

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}")