hoops_ai.ml.EXPERIMENTAL.flow_model_graphnode_classification

Classes

GraphNodeClassification([num_classes, ...])

GraphNodeClassification is a user-friendly wrapper around the BrepSeg model.

class hoops_ai.ml.EXPERIMENTAL.flow_model_graphnode_classification.GraphNodeClassification(num_classes=25, n_layers_encode=8, dim_node=256, d_model=512, n_heads=32, dropout=0.3, attention_dropout=0.3, act_dropout=0.3, learning_rate=0.002, optimizer_betas=(0.99, 0.999), scheduler_factor=0.5, scheduler_patience=5, scheduler_threshold=0.0001, scheduler_min_lr=1e-06, scheduler_cooldown=2, max_warmup_steps=5000, log_file='training_errors.log', result_dir=None, generate_stream_cache_for_visu=False, **kwargs)

Bases: FlowModel

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

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

  • n_layers_encode (int, optional) – Number of encoding layers in the BrepEncoder. Default: 6

  • dim_node (int, optional) – Dimension of node embeddings. Default: 256

  • d_model (int, optional) – Dimension of the model in BrepEncoder. Default: 512

  • n_heads (int, optional) – Number of attention heads in BrepEncoder. Default: 8

  • dropout (float, optional) – Dropout rate for the classifier. Default: 0.3

  • attention_dropout (float, optional) – Dropout rate for attention layers. Default: 0.1

  • act_dropout (float, optional) – Dropout rate for activation layers. Default: 0.1

  • learning_rate (float, optional) – Initial learning rate for the optimizer. Default: 0.002

  • optimizer_betas (Tuple[float, float], optional) – Betas for the AdamW optimizer. Default: (0.99, 0.999)

  • scheduler_factor (float, optional) – Factor for ReduceLROnPlateau scheduler. Default: 0.5

  • scheduler_patience (int, optional) – Patience for ReduceLROnPlateau scheduler. Default: 5

  • scheduler_threshold (float, optional) – Threshold for ReduceLROnPlateau scheduler. Default: 1e-4

  • scheduler_min_lr (float, optional) – Minimum learning rate for scheduler. Default: 1e-6

  • scheduler_cooldown (int, optional) – Cooldown period for scheduler. Default: 2

  • max_warmup_steps (int, optional) – Number of warmup steps for learning rate scaling. Default: 5000

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

  • **kwargs (Any) – Additional keyword arguments for BrepSeg.

  • CONSTRUCTOR!!!!! (" LUIS CHECKS DEFAULT PARAMETERS EITHER THIS ONE OF THE ONE IN THE)

  • parameters (# Model) – default_model_params = { “num_classes”: 25, “n_layers_encode”: 8, “dim_node”: 256, “d_model”: 512, “n_heads”: 32, “dropout”: 0.3, “attention_dropout”: 0.3, “act_dropout”: 0.3,

  • }

  • result_dir (str)

  • generate_stream_cache_for_visu (bool)

  • **kwargs

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 BrepMFR model, including author, 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 training 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 the predictions and their associated probabilities.

Return type:

Any

retrieve_model(check_point=None)

Retrieves the PyTorch Lightning model used in this flow.

Parameters:

check_point (str)

Return type:

pytorch_lightning.LightningModule