Package: deepray
DeePray(深度祈祷): A new Modular, Scalable, Configurable, Easy-to-Use and Extend infrastructure for Deep Learning based Recommendation.IntroductionThe DeePray library offers state-of-the-art algorithms for [deep learning recommendation].
DeePray is built on latest [TensorFlow 2][(https://tensorflow.org/)] and designed with modular structure，
making it easy to discover patterns and answer questions about tabular-structed data.The main goals of DeePray:Easy to use, newbies can get hands dirty with deep learning quicklyGood performance with web-scale dataEasy to extend, Modular architecture let you build your Neural network like playing LEGO!Let's Get Started! Please refer to the official docs athttps://deepray.readthedocs.io/en/latest/.InstallationInstall DeePray using PyPI:To install DeePray library fromPyPIusingpip, execute the following command:pip install deeprayInstall DeePray from Github source:First, clone the DeePray repository usinggit:git clone https://github.com/fuhailin/deepray.gitThen,cdto the deepray folder, and install the library by executing the following commands:cd deepray
pip install .TutorialCensus Adult Data SetData preparationIn your tabular data, specifyNUMERICALfor your continue features,CATEGORYfor categorical features,VARIABLEfor variable length features, and obviouslyLABELfor label column. Then process them to  toTFRecordformat into order to get good performance with large-scale dataset.importpandasaspdfromsklearn.model_selectionimporttrain_test_splitfromsklearn.preprocessingimportMinMaxScaler,LabelEncoderfromdeepray.utils.converterimportCSV2TFRecord# http://archive.ics.uci.edu/ml/datasets/Adulttrain_data='DeePray/examples/census/data/raw_data/adult_data.csv'df=pd.read_csv(train_data)df['income_label']=(df["income_bracket"].apply(lambdax:">50K"inx)).astype(int)df.pop('income_bracket')NUMERICAL_FEATURES=['age','fnlwgt','hours_per_week','capital_gain','capital_loss','education_num']CATEGORY_FEATURES=[colforcolindf.columnsifcol!=LABELandcolnotinNUMERICAL_FEATURES]LABEL=['income_label']forfeatinCATEGORY_FEATURES:lbe=LabelEncoder()df[feat]=lbe.fit_transform(df[feat])# Feature normilizationmms=MinMaxScaler(feature_range=(0,1))df[NUMERICAL_FEATURES]=mms.fit_transform(df[NUMERICAL_FEATURES])prebatch=1# flags.prebatchconverter=CSV2TFRecord(LABEL,NUMERICAL_FEATURES,CATEGORY_FEATURES,VARIABLE_FEATURES=[],gzip=False)converter.write_feature_map(df,'./data/feature_map.csv')train_df,valid_df=train_test_split(df,test_size=0.2)converter(train_df,out_file='./data/train.tfrecord',prebatch=prebatch)converter(valid_df,out_file='./data/valid.tfrecord',prebatch=prebatch)You will get a feature map file like that:9,workclass,CATEGORICAL
16,education,CATEGORICAL
7,marital_status,CATEGORICAL
15,occupation,CATEGORICAL
6,relationship,CATEGORICAL
5,race,CATEGORICAL
2,gender,CATEGORICAL
42,native_country,CATEGORICAL
1,hours_per_week,NUMERICAL
1,capital_gain,NUMERICAL
1,age,NUMERICAL
1,fnlwgt,NUMERICAL
1,capital_loss,NUMERICAL
1,education_num,NUMERICAL
2,income_label,LABELAnd then create two txt filetrainandvalidseparately to record train set TFRecords and valid set TFRecords file path.Choose your model, Training and evaluation"""build and train model"""importsysfromabslimportapp,flagsimportdeeprayasdpfromdeepray.base.trainerimporttrainfromdeepray.model.build_modelimportBuildModelFLAGS=flags.FLAGSdefmain(flags=None):FLAGS(flags,known_only=True)flags=FLAGSmodel=BuildModel(flags)history=train(model)print(history)argv=[sys.argv[0],'--model=lr','--train_data=/Users/vincent/Projects/DeePray/examples/census/data/train','--valid_data=/Users/vincent/Projects/DeePray/examples/census/data/valid','--feature_map=/Users/vincent/Projects/DeePray/examples/census/data/feature_map.csv','--learning_rate=0.01','--epochs=10','--batch_size=64',]main(flags=argv)Models ListTitileBooktitleResourcesFM: Factorization MachinesICDM'2010[pdf][code]FFM: Field-aware Factorization Machines for CTR PredictionRecSys'2016[pdf][code]FNN: Deep Learning over Multi-field Categorical Data: A Case Study on User Response PredictionECIR'2016[pdf][code]PNN: Product-based Neural Networks for User Response PredictionICDM'2016[pdf][code]Wide&Deep: Wide & Deep Learning for Recommender SystemsDLRS'2016[pdf][code]AFM: Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention NetworksIJCAI'2017[pdf][code]NFM: Neural Factorization Machines for Sparse Predictive AnalyticsSIGIR'2017[pdf][code]DeepFM: DeepFM: A Factorization-Machine based Neural Network for CTR Prediction[C]IJCAI'2017[pdf][code]DCN: Deep & Cross Network for Ad Click PredictionsADKDD'2017[pdf][code]xDeepFM: xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender SystemsKDD'2018[pdf][code]DIN: DIN: Deep Interest Network for Click-Through Rate PredictionKDD'2018[pdf][code]DIEN: DIEN: Deep Interest Evolution Network for Click-Through Rate PredictionAAAI'2019[pdf][code]DSIN: Deep Session Interest Network for Click-Through Rate PredictionIJCAI'2019[pdf][code]AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural NetworksCIKM'2019[pdf][code]FLEN: Leveraging Field for Scalable CTR PredictionAAAI'2020[pdf][code]DFN: Deep Feedback Network for RecommendationIJCAI'2020[pdf][code]How to build your own model with DeePrayInheritingBaseCTRModelclass fromfrom deepray.model.model_ctr, and implement your ownbuild_network()method!ContributionDeePray is still under development, and call for contributions!* Hailin Fu (`Hailin <https://github.com/fuhailin>`)
* Call for contributions!让DeePray成为推荐算法新基建需要你的贡献CitingDeePray is designed, developed and supported byHailin.
If you use any part of this library in your research, please cite it using the following BibTex entry@misc{DeePray,
  author ={Hailin Fu},
  title ={DeePray: A new Modular, Scalable, Configurable, Easy-to-Use and Extend infrastructure for Deep Learning based Recommendation},
  year ={2020},
  publisher ={GitHub},
  journal ={GitHub Repository},
  howpublished ={\url{https://github.com/fuhailin/deepray}},}LicenseCopyright (c) Copyright © 2020 The DeePray Authors. All Rights Reserved.Licensed under theApachLicense.Referencehttps://github.com/shenweichen/DeepCTRhttps://github.com/aimetrics/jarvishttps://github.com/shichence/AutoIntContactIf you want cooperation or have any questions, please follow my wechat offical account:公众微信号ID：【StateOfTheArt】