, "Never-married", "Separated", "Married-AF-spouse", "Widowed" ]) relationship = tf.feature_column.categorical_column_with_vocabulary_list( "relationship", [ "Husband", "Not-in-family", "Wife", "Own-child", "Unmarried", "Other-relative" ]) workclass = tf.feature_column.categorical_column_with_vocabulary_list( "workclass", [ "Self-emp-not-inc", "Private", "State-gov", "Federal-gov", "Local-gov", "?", "Self-emp-inc", "Without-pay", "Never-worked" ]) # 展示一个哈希的例子: occupation = tf.feature_column.categorical_column_with_hash_bucket( "occupation", hash_bucket_size=1000) native_country = tf.feature_column.categorical_column_with_hash_bucket( "native_country", hash_bucket_size=1000) # 持续基列 age = tf.feature_column.numeric_column("age") education_num = tf.feature_column.numeric_column("education_num") capital_gain = tf.feature_column.numeric_column("capital_gain") capital_loss = tf.feature_column.numeric_column("capital_loss") hours_per_week = tf.feature_column.numeric_column("hours_per_week") # 转换 age_buckets = tf.feature_column.bucketized_column( age, boundaries=[18, 25, 30, 35, 40, 45, 50, 55, 60, 65]) 广度模型:具有交叉特点列的线性模型
广度模型是一个具有稀少和交叉特点列的线性模型:
- base_columns = [
- gender, native_country, education, occupation, workclass, relationship,
- age_buckets,
- ]
-
- crossed_columns = [
- tf.feature_column.crossed_column(
- ["education", "occupation"], hash_bucket_size=1000),
- tf.feature_column.crossed_column(
- [age_buckets, "education", "occupation"
推荐阅读
张一鸣:探讨人工智能边界就是探讨人类文明边界
CTO练习营 | 12月3-5日,深圳,是时刻成为优良的技巧治理者了
今日头条开创人兼CEO张一鸣我们要实现本身的愿景,必须在全球范围内去解决三个问题:第一个是应用处景的问题,这本质上是一个>>>详细阅读
本文标题:TensorFlow广度和深度学习的教程
地址:http://www.17bianji.com/lsqh/39382.html
1/2 1