【TF】tf.feature_column特征处理方法汇总

0.目的

学习tf.feature_column对特征处理函数使用方法,研究研究这个东西怎么使用。

文章链接:

【TensorFlow】(一) tf.feature_column.categorical_column_with_identity()函数的使用

【TensorFlow】(二)tf.feature_column.categorical_column_with_hash_bucket()函数的用法

【TensorFlow】(三)tf.feature_column.shared_embedding_columns()函数的用法

【TensorFlow】(四)tf.feature_column.embedding_column()函数

【TensorFlow】(五)tf.feature_column.categorical_column_with_vocabulary_list()函数的作用及用法

【TensorFlow】(六)tf.feature_column.categorical_column_with_vocabulary_file()函数的作用及用法

【TensorFlow】(七)tf.feature_column.crossed_column()函数的作用及用法

【TensorFlow】(八)tf.feature_column.indicator_column()函数的作用及用法

未完待续

1. 背景

tf.estimator是tensorflow的一个高级API接口,它最大的特点在于兼容分布式和单机两种场景,工程师可以在同一套代码结构下即实现单机训练也可以实现分布式训练,正是因为这样的特点,目前包括阿里在内的很多公司都在使用这一接口来构建自己的深度学习模型。

特征预处理是几乎所有机器学习模型所必须的一个过程,常见的特征预处理方法包括:

  1. 连续变量分箱化
  2. 离散变量one-hot
  3. 离散指标embedding

tensorflow给我们提供了一个功能强大的特征处理函数tf.feature_column,它通过对特征处理将数据输入网络并交由estimator来进行训练,本文通过实际的数据输出来直观地介绍与展现tf.feature_column的基本用法。

2. tf.feature_column数据处理的方法

特征数据主要包括categorical和dense两类,另外一类是序列特征处理。

处理方法是使用tensorflow中的feature_column接口来进行定义,如下图,indicator_column常用来转换化categorical_column_*的输出,再作为input_layer的输入。

3.实验环境:

mac:10.14.6

python:2.7

TensorFlow:1.14

pycharm:2020.01

 

参考:

1.tf.feature_column特征处理:https://zhuanlan.zhihu.com/p/73701872

2.TensorFlow官方文档:https://www.tensorflow.org/api_docs/python/tf/feature_column

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值