weaviate.classification
Module for classifying objects within Weaviate.
- class weaviate.classification.Classification(connection: Connection)
Bases:
object
Classification class used to schedule and/or check the status of a classification process of Weaviate objects.
Initialize a Classification class instance.
- Parameters:
connection (weaviate.connect.Connection) – Connection object to an active and running Weaviate instance.
- get(classification_uuid: str) dict
Polls the current state of the given classification.
- Parameters:
classification_uuid (str) – Identifier of the classification.
- Returns:
A dict containing the Weaviate answer.
- Return type:
dict
- Raises:
ValueError – If not a proper uuid.
requests.ConnectionError – If the network connection to weaviate fails.
weaviate.UnexpectedStatusCodeException – If weaviate reports a none OK status.
- is_complete(classification_uuid: str) bool
Checks if a started classification job has completed.
- Parameters:
classification_uuid (str) – Identifier of the classification.
- Returns:
True if given classification has finished, False otherwise.
- Return type:
bool
- is_failed(classification_uuid: str) bool
Checks if a started classification job has failed.
- Parameters:
classification_uuid (str) – Identifier of the classification.
- Returns:
True if the classification failed, False otherwise.
- Return type:
bool
- is_running(classification_uuid: str) bool
Checks if a started classification job is running.
- Parameters:
classification_uuid (str) – Identifier of the classification.
- Returns:
True if the classification is running, False otherwise.
- Return type:
bool
- schedule() ConfigBuilder
Schedule a Classification of the Objects within Weaviate.
- Returns:
A ConfigBuilder that should be configured to the desired classification task
- Return type:
- class weaviate.classification.ConfigBuilder(connection: Connection, classification: Classification)
Bases:
object
ConfigBuild class that is used to configure a classification process.
Initialize a ConfigBuilder class instance.
- Parameters:
connection (weaviate.connect.Connection) – Connection object to an active and running weaviate instance.
classification (weaviate.classification.Classification) – Classification object to be configured using this ConfigBuilder instance.
- do() dict
Start the classification.
- Returns:
Classification result.
- Return type:
dict
- with_based_on_properties(based_on_properties: list) ConfigBuilder
Set properties to build the classification on.
- Parameters:
based_on_properties (list) – A list of properties to classify on.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_class_name(class_name: str) ConfigBuilder
What Object type to classify.
- Parameters:
class_name (str) – Name of the class to be classified.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_classify_properties(classify_properties: list) ConfigBuilder
Set the classify properties.
- Parameters:
classify_properties (list) – A list of properties to classify.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_k(k: int) ConfigBuilder
Set k number for the kNN.
- Parameters:
k (int) – Number of objects to use to make a classification guess. (For kNN)
- Returns:
Updated ConfigBuilder.
- Return type:
- with_settings(settings: dict) ConfigBuilder
Set settings for the classification. NOTE if you are using ‘kNN’ the value ‘k’ can be set by this method or by ‘with_k’. This method keeps previously set ‘settings’.
- Parameters:
settings (dict) – Additional settings to be set/overwritten.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_source_where_filter(where_filter: dict) ConfigBuilder
Set Source ‘where’ Filter.
- Parameters:
where_filter (dict) – Filter to use, as a dict.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_target_where_filter(where_filter: dict) ConfigBuilder
Set Target ‘where’ Filter.
- Parameters:
where_filter (dict) – Filter to use, as a dict.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_training_set_where_filter(where_filter: dict) ConfigBuilder
Set Training set ‘where’ Filter.
- Parameters:
where_filter (dict) – Filter to use, as a dict.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_type(classification_type: str) ConfigBuilder
Set classification type.
- Parameters:
classification_type (str) – Type of the desired classification.
- Returns:
Updated ConfigBuilder.
- Return type:
- with_wait_for_completion() ConfigBuilder
Wait for completion.
- Returns:
Updated ConfigBuilder.
- Return type: