train

train(data, model, loss_fun, num_epochs=10000, patience=20, lr=0.01, weight_decay=0.0, verbose=True, logger=<function <lambda>>)[source]

train an embedding model

Parameters:
  • data – network data

  • model – embedding auto-encoder model

  • loss_fun – loss function to use with model (takes arguments model, data)

  • num_epochs – number of training epochs

  • patience – patience for early stopping

  • lr – learining rate (default: 0.01)

  • weight_decay – weight decay for optimizer (default: 0.0)

  • verbose – if True, display training progress (default: True)

  • logger – function that receives the training loss as input and is called after each epoch (does nothing by default)

Returns:

trained model

This function uses the Adam optimizer for training.