This is a forked self-maintained version of Wide-Deep by Lapis-Hong
A general Wide and Deep Joint Learning Framework. Deep part can be a simple Dnn, Dnn Variants(ResDnn, DenseDnn), MultiDnn or even combine with Cnn (Dnn-Cnn).
Here, the wide and deep model is used to predict the click labels. The wide model is able to memorize interactions with data with a large number of features but not able to generalize these learned interactions on new data. The deep model generalizes well but is unable to learn exceptions within the data. The wide and deep model combines the two models and is able to generalize while learning exceptions.
The code uses the high level tf.estimator.Estimator
API.
This API is great for fast iteration and quickly adapting models to your own datasets without major code overhauls.
It allows you to move from single-worker training to distributed training, and it makes it easy to export model
binaries for prediction.
The input function for the Estimator
uses tf.data.Dataset
API, which creates a Dataset
object.
The Dataset
API makes it easy to apply transformations (map, batch, shuffle, etc.) to the data.
Read more here.
The code is based on the TensorFlow wide and deep tutorial.
The Minimal required tensorflow version is r1.14 since I changed most of tensorflow api to tensorflow 2 compatible version.
- provide very flexible feature configuration and train configuration.
- scalable to arbitrarily train data size in production environment.
- support multi value feature input (multihot).
- support distributed tensorflow
- support custom dnn network (arbitrary connections between layers) with flexible options.
- support BN layer; activation_fn; l1,l2 reg; weight decay lr options for training.
- support dnn, multidnn joint learning, even combine with cnn.
- support 3 types normalization for continuous features.
- support weight column for imbalance sample.
- provide tensorflow serving for tf.estimator.
- Compatible version between tensorflow 1 and 2.
- python >=3.5
- tensorflow >=1.14
- tensorflow-serving-api
- numpy
- yaml
- PIL
- absl-py
cd conf
vim feature.yaml
vim model.yaml
vim train.yaml
...
You can run the code locally as follows:
cd python
python train.py
or use shell scripts as follows:
cd scripts
bash train.sh
python eval.py
or use shell scripts as follows:
bash test.sh
run the code on ps as follows:
cd scripts
bash run_ps.sh
Run TensorBoard to inspect the details about the graph and training progression.
tensorboard --logdir=./model/wide_deep