改数据形式问题改了半天。。。
要了解原理的朋友出门右转:TensorFlow Wide And Deep 模型详解与应用
# coding = gbk
"""Example code for TensorFlow Wide & Deep Tutorial using TF.Learn API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import shutil
import sys
import tempfile
import pandas as pd
from six.moves import urllib
import tensorflow as tf
CSV_COLUMNS = [
"jing", "ceng", "y", "DEPTH", "AC",
"SP", "GR", "CAL", "RT"
]
# To show an example of hashing:
jing = tf.feature_column.categorical_column_with_hash_bucket(
"jing", hash_bucket_size=350)
ceng = tf.feature_column.categorical_column_with_hash_bucket(
'ceng', hash_bucket_size=350)
# Continuous base columns.
DEPTH = tf.feature_column.numeric_column("DEPTH")
AC = tf.feature_column.numeric_column("AC")
SP = tf.feature_column.numeric_column("SP")
GR = tf.feature_column.numeric_column("GR")
CAL = tf.feature_column.numeric_column("CAL")
RT = tf.feature_column.numeric_column('RT')
# Transformations.
depth_buckets = tf.feature_column.bucketized_column(
DEPTH, boundaries=[300, 800, 1300, 1800, 2300, 2800, 3300, 3800])
# Wide columns and deep columns.
base_column