MARBLE module

Main network

class MARBLE.main.net(data, loadpath=None, params=None, verbose=True)[source]

MARBLE neural network.

The possible parameters and their default values are described below, and can be accessed via the params dictionnary in this class constructor.

Parameters:
  • batch_size – batch size (default=64)

  • epochs – optimisation epochs (default=20)

  • lr – iniital learning rate (default=0.01)

  • momentum – momentum (default=0.9)

  • diffusion – set to True to use diffusion layer before gradient computation (default=False)

  • include_positions – include positions as features (warning: this is untested) (default=False)

  • include_self – include vector at the center of feature (default=True)

  • order – order to which to compute the directional derivatives (default=2)

  • inner_product_features – transform gradient features to inner product features (default=True)

  • frac_sampled_nb – fraction of neighbours to sample for gradient computation (if -1 then all neighbours) (default=-1)

  • dropout – dropout in the MLP (default=0.)

  • hidden_channels – number of hidden channels (default=16). If list, then adds multiple layers.

  • out_channels – number of output channels (if null, then =hidden_channels) (default=3)

  • bias – learn bias parameters in MLP (default=True)

  • vec_norm – normalise features at each derivative order to unit length (default=False)

  • emb_norm – normalise MLP output to unit length (default=False)

  • batch_norm – batch normalisation (default=True)

  • seed – seed for reproducibility

Constructor of the MARBLE net.

Parameters:
  • data – PyG data

  • loadpath – path to a model file, or a directory with models (best model will be used)

  • params – dict with parameters to overwrite default params or a path to a yaml file

  • verbose – run in verbose mode

parse_parameters(data)[source]

Load default parameters and merge with user specified parameters

check_parameters(data)[source]

Check parameter validity

reset_parameters()[source]

reset parmaeters.

setup_layers()[source]

Setup layers.

forward(data, n_id, adjs=None)[source]

Forward pass. Messages are passed to a set target nodes (current batch) from source nodes. The source nodes and target nodes form a bipartite graph to simplify message passing. By convention, the first size[1] entries of x are the target nodes, i.e, x = concat[x_target, x_other].

evaluate(data)[source]

Evaluate.

transform(data)[source]

Forward pass @ evaluation (no minibatches)

batch_loss(data, loader, train=False, verbose=False, optimizer=None)[source]

Loop over minibatches provided by loader function.

Parameters:
  • x – (nxdim) feature matrix

  • loader – dataloader object from dataloader.py

run_training(data, outdir=None, verbose=False)[source]

Run training.

fit(data, outdir=None, verbose=False)[source]

Network training.

Parameters:
  • data – PyG data

  • outdir – folder to save intermediate models

  • verbose – run in verbose mode

load_model(loadpath)[source]

Load model.

Parameters:

loadpath – directory with models to load best model, or specific model path

save_model(optimizer, losses, outdir=None, best=False, timestamp='')[source]

Save model.

class MARBLE.main.loss_fun(*args, **kwargs)[source]

Loss function.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(out, mask=None)[source]

forward.