GithubHelp home page GithubHelp logo

loochao / 2018-tencent-ad-competition-baseline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youchounobb/2018-tencent-ad-competition-baseline

0.0 1.0 0.0 86 KB

2018腾讯广告算法大赛baseline 线上0.73

Python 100.00%

2018-tencent-ad-competition-baseline's Introduction

项目介绍

    因为数据太大,而且不是能直接pandas读取的格式,所以需要做格式转换,用dict的方式来初始化DataFrame

  • 2.拼接用户特征,广告特征

    训练数据中负样本的标签给的是-1,需要先转成0,预测数据的标签置为-1,方便合并后区分数据集。将缺失值填充为 '-1' ,为什么不是数值的-1呢?因为在LabelEncoder的时候需要对数据排序,同时存在string和int类型是无法比较的。所以需要填充为string类型的 ‘-1’。
    
  • 3.将单取值的离散特征使用稀疏方式one-hot

    为什么要先将数据划分为训练集和测试集呢,因为稀疏的数据是无法分片的,所以只能先划分数据,分别拼接稀疏特征。如果使用pd.get_dummy()来获取onehot特征,生成的数据是可以用来分片的,但是稠密存储是个致命弱点。
    github上很多人问我train_x=train[['creativeSize']] 这句是什么意思,其实creativeSize这个特征是数值特征,不需要进行特别的处理,如果想处理的话可以考虑pd.cut来分段离散化。另一个原因是把这个特征拿出来构造一个新的DataFrame,方便和后面生成的稀疏特征进行拼接。所以使用的是[[]]来取值获得一个DataFrame,而不是[]取值来或者一个Seris
    
  • 4.将多取值的离散特征使用稀疏方式向量化

    这个操作估计很多同学之前没有见过,一般出现在自然语言处理中,计算TF-IDF,LDA等时候使用,但是同样可以用来生成一个稀疏向量,作为新的特征,同时可以一个特征生成多个特征,比单独的处理更加方便。
    
  • 5.线下测试

    使用train_test_split划分数据,这行注释掉了。
    
  • 6.线上提交

    线上预测的时候,模型训练中early_stopping_rounds 这个参数没什么用,参数n_estimatorsxu需要根据线下测试来重新指定。我看到有些同学设置为10000取得了0.74的成绩。。。。
    

  • baseline_v2 16g左右内存使用,建议开启虚拟内存
  • 将训练集分片,分别训练预测,然后将预测结果求平均,大概需要15g内存

  • baseline_v3 只要能读进去数据,join完应该就能跑了
  • 每次训练重新读取的数据,这样应该8g内存就能跑了

--可以先使用 user_feature_tocsv.py 将用户特征转换成csv文件,以便后面直接pd.read_csv读入

2018-tencent-ad-competition-baseline's People

Contributors

youchounobb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.