elliot.recommender.graph_based.lightgcn package

Submodules

elliot.recommender.graph_based.lightgcn.LightGCN module

Module description:

class elliot.recommender.graph_based.lightgcn.LightGCN.LightGCN(data, config, params, *args, **kwargs)[source]

Bases: elliot.recommender.recommender_utils_mixin.RecMixin, elliot.recommender.base_recommender_model.BaseRecommenderModel

LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation

For further details, please refer to the paper

Parameters
  • lr – Learning rate

  • epochs – Number of epochs

  • factors – Number of latent factors

  • batch_size – Batch size

  • l_w – Regularization coefficient

  • n_layers – Number of embedding propagation layers

  • n_fold – Number of folds to split the adjacency matrix into sub-matrices and ease the computation

To include the recommendation model, add it to the config file adopting the following pattern:

models:
  LightGCN:
    meta:
      save_recs: True
    lr: 0.0005
    epochs: 50
    batch_size: 512
    factors: 64
    batch_size: 256
    l_w: 0.1
    n_layers: 1
    n_fold: 5
get_recommendations(k: int = 100)[source]
property name
train()[source]

elliot.recommender.graph_based.lightgcn.LightGCN_model module

Module description:

class elliot.recommender.graph_based.lightgcn.LightGCN_model.LightGCNModel(*args, **kwargs)[source]

Bases: tensorflow.python.keras.engine.training.Model

call(inputs, **kwargs)[source]

Generates prediction for passed users and items indices

Parameters
  • inputs – user, item (batch)

  • Network in training mode or inference mode. (the) –

Returns

prediction and extracted model parameters

get_config()[source]

Returns the config of the layer.

A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration.

The config of a layer does not include connectivity information, nor the layer class name. These are handled by Network (one layer of abstraction above).

Returns

Python dictionary.

get_top_k(preds, train_mask, k=100)[source]
predict(start, stop, **kwargs)[source]
train_step(batch)[source]

Apply a single training step on one batch.

Parameters

batch – batch used for the current train step

Returns

loss value at the current batch

Module contents