Dense Model¶
- class symdet.ml_models.dense_model.DenseModel(n_layers: int = 5, units: int = 10, epochs: int = 20, activation: str = 'relu', monitor: str = 'accuracy', lr: float = 0.0001, batch_size: int = 100, terminate_patience: int = 10, lr_patience: int = 5)[source]¶
Class for the construction and training of a dense NN model
- data_dict¶
Dictionary of data where the key is the class name and the values are the coordinates belongin to that class. This is fundamentall a classification problem!
- Type
dict
- n_layers¶
Number of hidden layers to use.
- Type
int
- units¶
Number of units to use in each layer.
- Type
int
- epochs¶
Number of epochs during training.
- Type
int
- activation¶
Activation function to use.
- Type
str
- monitor¶
Monitor parameter for use in training.
- Type
str
- lr¶
Learning rate of the algorithm.
- Type
float
- batch_size¶
batch size for the training.
- Type
int
- terminate_patience¶
Patience value for termination to be used in a callback.
- Type
int
- lr_patience¶
Patience in the learning rate reduction.
- Type
int
- train_ds¶
Train dataset.
- Type
tf.data.Dataset
- test_ds¶
Test dataset.
- Type
tf.data.Dataset
- val_ds¶
validation dataset.
- Type
tf.data.Dataset
- model¶
Tensorflow model to train.
- Type
tf.keras.Model
Methods
add_data(data)Add cluster data to the model.
get_embedding_layer_representation(data_array)Return the representation constructed by the embedding layer
Collect other methods and train the ML model
- add_data(data: dict)[source]¶
Add cluster data to the model.
- Parameters
data (dict) – Cluster data to be added to the class.
- get_embedding_layer_representation(data_array: ndarray) Tensor[source]¶
Return the representation constructed by the embedding layer
- Parameters
data_array (np.array) – Data on which the model should be applied
- Returns
predictions – Predictions on the data_array returned in their high dimensional representation.
- Return type
tf.Tensor