Custom Model MLP¶
- class src.domain_classifier.custom_model_mlp.CustomDatasetMLP(df_data)¶
Bases:
Dataset
- __init__(df_data)¶
- class src.domain_classifier.custom_model_mlp.MLP(input_dim, hidden_dim, output_dim)¶
Bases:
Module
- __init__(input_dim, hidden_dim, output_dim)¶
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- eval_model(eval_iterator, device='cuda', batch_size=8)¶
Evaluate trained model
- Parameters:
df_train (DataFrame) – Training dataframe
epochs (int) – Number of epochs to train model
device (str, optional (default=”cuda”)) – If “cuda”, a GPU is used if available
batch_size (int, optiona (default=8)) – Batch size
- forward(x)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.