torchfm.model

torchfm.model.afi

class torchfm.model.afi.AutomaticFeatureInteractionModel(field_dims, embed_dim, num_heads, num_layers, mlp_dims, dropouts)[source]

A pytorch implementation of AutoInt.

Reference:

W Song, et al. AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks, 2018.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.afm

class torchfm.model.afm.AttentionalFactorizationMachineModel(field_dims, embed_dim, attn_size, dropouts)[source]

A pytorch implementation of Attentional Factorization Machine.

Reference:

J Xiao, et al. Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks, 2017.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.dcn

class torchfm.model.dcn.DeepCrossNetworkModel(field_dims, embed_dim, num_layers, mlp_dims, dropout)[source]

A pytorch implementation of Deep & Cross Network.

Reference:

R Wang, et al. Deep & Cross Network for Ad Click Predictions, 2017.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.dfm

class torchfm.model.dfm.DeepFactorizationMachineModel(field_dims, embed_dim, mlp_dims, dropout)[source]

A pytorch implementation of DeepFM.

Reference:

H Guo, et al. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction, 2017.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.ffm

class torchfm.model.ffm.FieldAwareFactorizationMachineModel(field_dims, embed_dim)[source]

A pytorch implementation of Field-aware Factorization Machine.

Reference:

Y Juan, et al. Field-aware Factorization Machines for CTR Prediction, 2015.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.fm

class torchfm.model.fm.FactorizationMachineModel(field_dims, embed_dim)[source]

A pytorch implementation of Factorization Machine.

Reference:

S Rendle, Factorization Machines, 2010.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.fnfm

class torchfm.model.fnfm.FieldAwareNeuralFactorizationMachineModel(field_dims, embed_dim, mlp_dims, dropouts)[source]

A pytorch implementation of Field-aware Neural Factorization Machine.

Reference:

L Zhang, et al. Field-aware Neural Factorization Machine for Click-Through Rate Prediction, 2019.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.fnn

class torchfm.model.fnn.FactorizationSupportedNeuralNetworkModel(field_dims, embed_dim, mlp_dims, dropout)[source]

A pytorch implementation of Neural Factorization Machine.

Reference:

W Zhang, et al. Deep Learning over Multi-field Categorical Data - A Case Study on User Response Prediction, 2016.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.lr

class torchfm.model.lr.LogisticRegressionModel(field_dims)[source]

A pytorch implementation of Logistic Regression.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.nfm

class torchfm.model.nfm.NeuralFactorizationMachineModel(field_dims, embed_dim, mlp_dims, dropouts)[source]

A pytorch implementation of Neural Factorization Machine.

Reference:

X He and TS Chua, Neural Factorization Machines for Sparse Predictive Analytics, 2017.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.pnn

class torchfm.model.pnn.ProductNeuralNetworkModel(field_dims, embed_dim, mlp_dims, dropout, method='inner')[source]

A pytorch implementation of inner/outer Product Neural Network.

Reference:

Y Qu, et al. Product-based Neural Networks for User Response Prediction, 2016.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.wd

class torchfm.model.wd.WideAndDeepModel(field_dims, embed_dim, mlp_dims, dropout)[source]

A pytorch implementation of wide and deep learning.

Reference:

HT Cheng, et al. Wide & Deep Learning for Recommender Systems, 2016.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)

torchfm.model.xdfm

class torchfm.model.xdfm.ExtremeDeepFactorizationMachineModel(field_dims, embed_dim, mlp_dims, dropout, cross_layer_sizes, split_half=True)[source]

A pytorch implementation of xDeepFM.

Reference:

J Lian, et al. xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems, 2018.

forward(x)[source]
Parameters

x – Long tensor of size (batch_size, num_fields)