hoops_ai.ml.EXPERIMENTAL.flow_model_graph_classification

Classes

GraphClassification([num_classes, ...])

GraphClassification is a user-friendly wrapper around the UVNet model.

class hoops_ai.ml.EXPERIMENTAL.flow_model_graph_classification.GraphClassification(num_classes=10, result_dir=None, log_file='cnn_graph_training_errors.log', generate_stream_cache_for_visu=False)

Bases: FlowModel

GraphClassification is a user-friendly wrapper around the UVNet model. It provides default hyperparameters and an interface for users to interact without directly accessing the UVnet class.

Parameters:
  • num_classes (int, optional) – Number of classes for classification. Default: 10

  • log_file (str, optional) – Path to the log file. Default: ‘training_errors.log’

  • result_dir (str)

  • generate_stream_cache_for_visu (bool)

collate_function(batch)

Return a collate function for this model.

Return type:

Any

convert_encoded_data_to_graph(storage, graph_handler, filename)

Converts encoded data from storage into a graph representation, which serves as input for the ML model.

Parameters:
Return type:

Dict[str, Any]

encode_cad_data(cad_file, cad_loader, storage)

Opens the CAD file and encodes its data into a format suitable for machine learning. Stores the encoded data using the provided storage handler.

Parameters:
Return type:

Tuple[int, int]

encode_label_data(label_storage, storage)

Uses the LabelStorage object to retrieve the labeling information for a given input Stores the label data for the specific machine learning Task

return the str key when the label data is found in the storage object and the size of the label data

Parameters:
Return type:

Tuple[str, int]

get_citation_info()

Provides citation details for the UV-Net model, including authors, paper title, publication year, model architecture, original applications, and a link to the open-source GitHub repository.

Returns:

A formatted citation string.

Return type:

str

load_model_input_from_files(graph_file, data_id, label_file=None)

Loads a single graph from a file to be used as input for the machine learning model.

Parameters:
  • graph_file (str)

  • data_id (int)

  • label_file (str)

Return type:

Any

metrics()

Publish/push the ml metrics after traiing the model

Return type:

MetricStorage

model_name()
Return type:

str

predict_and_postprocess(batch)

Post-processes and formats the raw model output into a structured prediction. Returns a numpy array with top 3 predictions and their probability percentages as integers.

Returns:

Array with shape (batch_size, 2, 3), where: - First dimension: batch items - Second dimension [0]: class indices (int) - Second dimension [1]: probability percentages (int)

Return type:

numpy.ndarray

retrieve_model(check_point=None)

Retrieves the PyTorch Lightning model used in this flow.

Parameters:

check_point (str)

Return type:

pytorch_lightning.LightningModule