Creating many feature columns in Tensorflow

前端 未结 3 955
轻奢々
轻奢々 2021-01-04 03:42

I\'m getting started on a Tensorflow project, and am in the middle of defining and creating my feature columns. However, I have hundreds and hundreds of features- it\'s a pr

3条回答
  •  时光取名叫无心
    2021-01-04 04:41

    The above two methods works only if the data is provided in pandas data frame where you have column name for each column. But, in case you have all numeric column and you don't want to name those columns. for e.g. reading several numerical columns from a numpy array, you can use something like this:-

    feature_column = [tf.feature_column.numeric_column(key='image',shape=(784,))] 
    
    input_fn = tf.estimator.inputs.numpy_input_fn(dict({'image':x_train})  
    

    where X_train is your numy array with 784 columns. You can check this post by Vikas Sangwan for more details.

提交回复
热议问题