deepcarskit.model.neucf

NeuCMF0i

References

Yong Zheng, Gonzalo Florez Arias. “A Family of Neural Contextual Matrix Factorization Models for Context-Aware Recommendations”, ACM UMAP, 2022

Notes

1). NeuCMF0i has 2 towers (MLP and MF), and it fuses contexts into MLP tower only.

2). NeuCMF0i creates embedding for each individual context conditions.

class deepcarskit.model.neucf.neucmf0i.NeuCMF0i(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation_list)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool

NeuCMF0w

References

Unger, M., Tuzhilin, A., & Livne, A. (2020). Context-aware recommendations based on deep learning frameworks. ACM Transactions on Management Information Systems (TMIS), 11(2), 1-15.

Notes

1). NeuCMF0w has 2 towers (MLP and MF), and it fuses contexts into MLP tower only.

2). NeuCMF0w utilizes context situation as a whole/a single dimension to be embedded

class deepcarskit.model.neucf.neucmf0w.NeuCMF0w(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool

NeuCMFi0

References

Yong Zheng, Gonzalo Florez Arias. “A Family of Neural Contextual Matrix Factorization Models for Context-Aware Recommendations”, ACM UMAP, 2022

Notes

1). NeuCMFi0 has 4 towers: MLP tower without contexts, MF tower with UI, MF with UC, MF with IC

2). i => we create embeddings for each individual context conditions when we fuse them into the MF towers

class deepcarskit.model.neucf.neucmfi0.NeuCMFi0(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation_list)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool

NeuCMFii

References

Yong Zheng, Gonzalo Florez Arias. “A Family of Neural Contextual Matrix Factorization Models for Context-Aware Recommendations”, ACM UMAP, 2022

Notes

1). NeuCMFii has 4 towers: MLP tower with contexts, MF tower with UI, MF with UC, MF with IC

2). ii => we create embeddings for each individual context conditions when we fuse contexts into the MLP and MF towers

class deepcarskit.model.neucf.neucmfii.NeuCMFii(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation_list)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool

NeuCMFw0

References

Yong Zheng, Gonzalo Florez Arias. “A Family of Neural Contextual Matrix Factorization Models for Context-Aware Recommendations”, ACM UMAP, 2022

Notes

1). NeuCMFw0 has 4 towers: MLP tower without contexts, MF tower with UI, MF with UC, MF with IC

2). w => we consider context situation as a whole/single dimension and create embedding for it, when we fuse them into the MF towers

class deepcarskit.model.neucf.neucmfw0.NeuCMFw0(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool

NeuCMFww

References

Yong Zheng, Gonzalo Florez Arias. “A Family of Neural Contextual Matrix Factorization Models for Context-Aware Recommendations”, ACM UMAP, 2022

Notes

1). NeuCMFww has 4 towers: MLP tower with contexts, MF tower with UI, MF with UC, MF with IC

2). ww => we consider context situation as a whole/single dimension and create embedding for it, when we fuse contexts into the MLP and MF towers

class deepcarskit.model.neucf.neucmfww.NeuCMFww(config, dataset)

Bases: deepcarskit.model.context_recommender.ContextRecommender

calculate_loss(interaction)

Calculate the training loss for a batch data.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

torch.Tensor: Training loss, shape: []

dump_parameters()

A simple implementation of dumping model parameters for pretrain.

forward(user, item, context_situation)

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.

input_type = 1
predict(interaction)

Predict the scores between users and items.

Args:

interaction (Interaction): Interaction class of the batch.

Returns:

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

training: bool