autointent.Pipeline#

class autointent.Pipeline(nodes, sampler='brute', seed=42)#

Pipeline optimizer class.

See tutorial on AutoML features of AutoIntent in User Guides.

Parameters:
nodes#
set_config(config)#

Set the configuration for the pipeline.

Parameters:

config (autointent.configs.LoggingConfig | autointent.configs.EmbedderConfig | autointent.configs.CrossEncoderConfig | autointent.configs.DataConfig) – Configuration object.

Return type:

None

classmethod from_search_space(search_space, seed=42)#

Instantiate pipeline optimizer from given search space.

Parameters:
Return type:

Pipeline

classmethod from_preset(name, seed=42)#

Instantiate pipeline optimizer from a preset.

Parameters:
  • name (autointent.custom_types.SearchSpacePreset)

  • seed (int | None)

Return type:

Pipeline

classmethod from_optimization_config(config)#

Create pipeline optimizer from optimization config.

Parameters:

config (dict[str, Any] | pathlib.Path | str | autointent.OptimizationConfig) – dictionary or a path to yaml file.

Return type:

Pipeline

fit(dataset, refit_after=False, sampler=None, incompatible_search_space='filter')#

Optimize the pipeline from dataset.

Parameters:
  • dataset (autointent.Dataset) – dataset for optimization.

  • refit_after (bool) – whether to refit on whole data after optimization. Valid only for hold-out validaiton.

  • sampler (autointent.custom_types.SamplerType | None) – sampler type to use.

  • incompatible_search_space (autointent.custom_types.SearchSpaceValidationMode) – wow to handle data-incompatible modules occurring in search space.

Raises:

RuntimeError – If pipeline is in inference mode.

Return type:

autointent.Context

dump(path=None)#

Dump pipeline to disk.

One can reuse it for inference later with autointent.Pipeline.load().

Parameters:

path (str | pathlib.Path | None)

Return type:

None

validate_modules(dataset, mode)#

Validate modules with dataset.

Parameters:
  • dataset (autointent.Dataset) – Dataset for validation.

  • mode (autointent.custom_types.SearchSpaceValidationMode) – Validation mode.

Return type:

None

classmethod from_config(nodes_configs)#

Create inference pipeline from config.

Parameters:

nodes_configs (list[autointent.configs.InferenceNodeConfig]) – list of config for nodes

Return type:

Pipeline

classmethod load(path, embedder_config=None, cross_encoder_config=None)#

Load pipeline in inference mode.

Parameters:
Return type:

Pipeline

predict(utterances)#

Predict the labels for the utterances.

Parameters:

utterances (list[str]) – list of utterances

Return type:

autointent.custom_types.ListOfGenericLabels

predict_with_metadata(utterances)#

Predict the labels for the utterances with metadata.

Parameters:

utterances (list[str]) – list of utterances

Return type:

autointent._pipeline._schemas.InferencePipelineOutput