KD_DAGFM

Reference:

Zhen Tian et al. “Directed Acyclic Graph Factorization Machines for CTR Prediction via Knowledge Distillation.” in WSDM 2023.

Reference code:

https://github.com/chenyuwuxin/DAGFM

class recbole.model.context_aware_recommender.kd_dagfm.CIN(config)[source]

Bases: torch.nn.modules.module.Module

FeatureInteraction(feature)[source]
forward(feature)[source]

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.

training: bool
class recbole.model.context_aware_recommender.kd_dagfm.CINComp(indim, outdim, config)[source]

Bases: torch.nn.modules.module.Module

forward(feature, base)[source]

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.

training: bool
class recbole.model.context_aware_recommender.kd_dagfm.CrossNet(config)[source]

Bases: torch.nn.modules.module.Module

FeatureInteraction(x_0)[source]
forward(feature)[source]

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.

training: bool
class recbole.model.context_aware_recommender.kd_dagfm.DAGFM(config)[source]

Bases: torch.nn.modules.module.Module

FeatureInteraction(feature)[source]
training: bool
class recbole.model.context_aware_recommender.kd_dagfm.KD_DAGFM(config, dataset)[source]

Bases: recbole.model.abstract_recommender.ContextRecommender

KD_DAGFM is a context-based recommendation model. The model is based on directed acyclic graph and knowledge distillation. It can learn arbitrary feature interactions from the complex teacher networks and achieve approximately lossless model performance. It can also greatly reduce the computational resource costs.

FeatureInteraction(feature)[source]
calculate_loss(interaction)[source]

Calculate the training loss for a batch data.

Parameters

interaction (Interaction) – Interaction class of the batch.

Returns

Training loss, shape: []

Return type

torch.Tensor

forward(interaction)[source]

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.

get_teacher_config(config)[source]
predict(interaction)[source]

Predict the scores between users and items.

Parameters

interaction (Interaction) – Interaction class of the batch.

Returns

Predicted scores for given users and items, shape: [batch_size]

Return type

torch.Tensor

training: bool