← 开源
ChenglongChen

tensorflow-DeepFM

Tensorflow implementation of DeepFM for CTR prediction.

Model DevelopmentClassical MLPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
2.06k
Star
799
Fork
+-1
本周
1
贡献者
创建于 2017-11-11 · 更新于 2026-10-09 · 今日第 9036 名
主要开发者
ChenglongChen

ChenglongChen/tensorflow-DeepFM 排名第 9,036,有 2,063 个星标。

同类别比较

ChenglongChen/tensorflow-DeepFM 排名第 9,036,此处有 8 个同类条目;multimodallearning/pytorch-mask-rcnn 排名第 9,034。

同类别比较
名称排名指标
NVIDIA-NeMo/RL9,028
语言:
Python
星标数:
2,067
分叉数:
601
简介:
Scalable toolkit for efficient model reinforcement
mapbox/robosat9,031
语言:
Python
星标数:
2,065
分叉数:
384
简介:
Semantic segmentation on aerial and satellite imagery. Extracts features such as: buildings, parking lots, roads, water, clouds
ozan-oktay/Attention-Gated-Networks9,032
语言:
Python
星标数:
2,065
分叉数:
437
简介:
Use of Attention Gates in a Convolutional Neural Network / Medical Image Classification and Segmentation
multimodallearning/pytorch-mask-rcnn9,034
语言:
Python
星标数:
2,064
分叉数:
545
lucidrains/toolformer-pytorch9,038
语言:
Python
星标数:
2,063
分叉数:
132
简介:
Implementation of Toolformer, Language Models That Can Use Tools, by MetaAI
facebookresearch/theseus9,040
语言:
Python
星标数:
2,060
分叉数:
152
简介:
A library for differentiable nonlinear optimization
tristandeleu/pytorch-meta9,043
语言:
Python
星标数:
2,058
分叉数:
264
简介:
A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
shanglianlm0525/PyTorch-Networks9,046
语言:
Python
星标数:
2,056
分叉数:
482
简介:
Pytorch implementation of cnn network
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Classical ML
星标数2,063
分叉数799
贡献者1
创建日期2017-11-11
更新日期2026-10-09
1 天星标数0
7 天星标数-1
排名9,036
上次排名9,075
排名变化39
7 天星标排名16,965
上次 7 天星标排名16,960
7 天星标排名变化-5
总星标排名6,183
上次总星标排名6,178
总星标排名变化-5
国家China
README 摘录

tensorflow-DeepFM This project includes a Tensorflow implementation of DeepFM [1]. NEWS A modified version of DeepFM is used to win the 4th Place for Mercari Price Suggestion Challenge on Kaggle. See the slide here how we deal with fields containing sequences, how we incoporate various FM components into deep model. Usage Input Format This implementation requires the input data in the following format: [ ] **Xi**: *[[ind1_1, ind1_2, . ]* [ ] **y**: target of each sample in the dataset (1/0 for

classification, numeric number for regression) Please see an example how to prepare the data in required format for DeepFM. Init and train a model You can use early_stopping in the training as follow You can refit the model on the whole training and validation set as follow You can use the FM or DNN part only by setting the parameter or to . Regression This implementation also supports regression task. To use DeepFM for regression, you can set as . Accordingly

, you should use eval_metric for regression, e. Example Folder includes an example usage of DeepFM/FM/DNN models for Porto Seguro's Safe Driver Prediction competition on Kaggle. Please download the data from the competition website and put them into the folder. To train DeepFM model for this dataset, run Please see how to parse the raw dataset into the required format for DeepFM. Performance DeepFM FM DNN Some tips [ ] You should tune the parameters for each model in order

to get reasonable performance. [ ] You can also try to ensemble these models or ensemble them with other models (e. Reference [1] *DeepFM: A Factorization-Machine based Neural Network for CTR Prediction*, Huifeng Guo, Ruiming Tang, Yunming Yey, Zhenguo Li, Xiuqiang He. Acknowledgments This project gets inspirations from the following projects: [ ] He Xiangnan's neural_factorization_machine [ ] Jian Zhang's YellowFin (yellowfin optimizer is taken from here) License MIT

常见问题

记录了多少星标和分叉?

ChenglongChen/tensorflow-DeepFM 有 2,063 个星标和 799 个分叉。

仓库排名是多少?

ChenglongChen/tensorflow-DeepFM 排名第 9,036。

记录的语言和类别是什么?

ChenglongChen/tensorflow-DeepFM 有 2,063 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

ChenglongChen/tensorflow-DeepFM 与 multimodallearning/pytorch-mask-rcnn 比较,后者排名第 9,034,有 2,064 个星标。

README

tensorflow-DeepFM

This project includes a Tensorflow implementation of DeepFM [1].

NEWS

Usage

Input Format

This implementation requires the input data in the following format:

  • [ ] Xi: [[ind1_1, ind1_2, ...], [ind2_1, ind2_2, ...], ..., [indi_1, indi_2, ..., indi_j, ...], ...]
    • indi_j is the feature index of feature field j of sample i in the dataset
  • [ ] Xv: [[val1_1, val1_2, ...], [val2_1, val2_2, ...], ..., [vali_1, vali_2, ..., vali_j, ...], ...]
    • vali_j is the feature value of feature field j of sample i in the dataset
    • vali_j can be either binary (1/0, for binary/categorical features) or float (e.g., 10.24, for numerical features)
  • [ ] y: target of each sample in the dataset (1/0 for classification, numeric number for regression)

Please see example/DataReader.py an example how to prepare the data in required format for DeepFM.

Init and train a model

import tensorflow as tf
from sklearn.metrics import roc_auc_score

# params
dfm_params = {
    "use_fm": True,
    "use_deep": True,
    "embedding_size": 8,
    "dropout_fm": [1.0, 1.0],
    "deep_layers": [32, 32],
    "dropout_deep": [0.5, 0.5, 0.5],
    "deep_layers_activation": tf.nn.relu,
    "epoch": 30,
    "batch_size": 1024,
    "learning_rate": 0.001,
    "optimizer_type": "adam",
    "batch_norm": 1,
    "batch_norm_decay": 0.995,
    "l2_reg": 0.01,
    "verbose": True,
    "eval_metric": roc_auc_score,
    "random_seed": 2017
}

# prepare training and validation data in the required format
Xi_train, Xv_train, y_train = prepare(...)
Xi_valid, Xv_valid, y_valid = prepare(...)

# init a DeepFM model
dfm = DeepFM(**dfm_params)

# fit a DeepFM model
dfm.fit(Xi_train, Xv_train, y_train)

# make prediction
dfm.predict(Xi_valid, Xv_valid)

# evaluate a trained model
dfm.evaluate(Xi_valid, Xv_valid, y_valid)

You can use early_stopping in the training as follow

dfm.fit(Xi_train, Xv_train, y_train, Xi_valid, Xv_valid, y_valid, early_stopping=True)

You can refit the model on the whole training and validation set as follow

dfm.fit(Xi_train, Xv_train, y_train, Xi_valid, Xv_valid, y_valid, early_stopping=True, refit=True)

You can use the FM or DNN part only by setting the parameter use_fm or use_dnn to False.

Regression

This implementation also supports regression task. To use DeepFM for regression, you can set loss_type as mse. Accordingly, you should use eval_metric for regression, e.g., mse or mae.

Example

Folder example includes an example usage of DeepFM/FM/DNN models for Porto Seguro's Safe Driver Prediction competition on Kaggle.

Please download the data from the competition website and put them into the example/data folder.

To train DeepFM model for this dataset, run

$ cd example
$ python main.py

Please see example/DataReader.py how to parse the raw dataset into the required format for DeepFM.

Performance

DeepFM

FM

DNN

Some tips

  • [ ] You should tune the parameters for each model in order to get reasonable performance.
  • [ ] You can also try to ensemble these models or ensemble them with other models (e.g., XGBoost or LightGBM).

Reference

[1] DeepFM: A Factorization-Machine based Neural Network for CTR Prediction, Huifeng Guo, Ruiming Tang, Yunming Yey, Zhenguo Li, Xiuqiang He.

Acknowledgments

This project gets inspirations from the following projects:

License

MIT

排名相邻
同类项目