特征工程6大方法

1) Add interaction features

Here you’ll add interaction features for each pair of categorical features (ip, app, device, os, channel). The easiest way to iterate through the pairs of features is with itertools.combinations. For each new column, join the values as strings with an underscore, so 13 and 47 would become "13_47". As you add the new columns to the dataset, be sure to label encode the values.

2) Number of events in the past six hours

The first feature you’ll be creating is the number of events from the same IP in the last six hours. It’s likely that someone who is visiting often will download the app.

Implement a function count_past_events that takes a Series of click times (timestamps) and returns another Series with the number of events in the last six hours. Tip: The rolling method is useful for this.

3) Features from future information

In the last exercise you created a feature that looked at past events. You could also make features that use information from events in the future. Should you use future events or not?

Run the following line after you’ve decided your answer.

4) Time since last event

Implement a function time_diff that calculates the time since the last event in seconds from a Series of timestamps. This will be ran like so:

timedeltas = clicks.groupby('ip')['click_time'].transform(time_diff)

5) Number of previous app downloads

It’s likely that if a visitor downloaded an app previously, it’ll affect the likelihood they’ll download one again. Implement a function previous_attributions that returns a Series with the number of times an app has been downloaded ('is_attributed' == 1) before the current event.

6) Tree-based vs Neural Network Models

So far we’ve been using LightGBM, a tree-based model. Would these features we’ve generated work well for neural networks as well as tree-based models?

Run the following line after you’ve decided your answer.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值