This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from layer import FactorizationMachine, FeaturesEmbedding, MultiLayerPerceptron, FeaturesLinear | |
class NeuralFactorizationMachineModel(torch.nn.Module): | |
""" | |
A Pytorch implementation of Neural Factorization Machine. | |
Reference: | |
X He and TS Chua, Neural Factorization Machines for Sparse Predictive Analytics, 2017. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from layer import CompressedInteractionNetwork, FeaturesEmbedding, FeaturesLinear, MultiLayerPerceptron | |
class ExtremeDeepFactorizationMachineModel(torch.nn.Module): | |
""" | |
A Pytorch implementation of xDeepFM. | |
Reference: | |
J Lian, et al. xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems, 2018. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from layer import FactorizationMachine, FeaturesEmbedding, FeaturesLinear, MultiLayerPerceptron | |
class DeepFactorizationMachineModel(torch.nn.Module): | |
""" | |
A Pytorch implementation of DeepFM. | |
Reference: | |
H Guo, et al. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction, 2017. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from layer import FeaturesLinear, FeaturesEmbedding, MultiLayerPerceptron | |
class WideAndDeepModel(torch.nn.Module): | |
""" | |
A Pytorch implementation of wide and deep learning. | |
Reference: | |
HT Cheng, et al. Wide & Deep Learning for Recommender Systems, 2016. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# These are the user indices, and correspond to "u" variable | |
user_id = train_x[:, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# These are the user indices, and correspond to "u" variable | |
user_id = train_x[:, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# These are the user indices, and correspond to "u" variable | |
user_id = train_x[:, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# These are the user indices, and correspond to "u" variable | |
user_id = train_x[:, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# Pull out biases | |
biases = index_into(self.bias_feat.weight, train_x).squeeze().sum(dim=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
class MF(nn.Module): | |
def __call__(self, train_x): | |
# These are the user and item indices | |
user_id = train_x[:, 0] |