Parsing CSV Features into Tensorflow for ANN

I am trying to figure how to properly get data from a CSV into tensorflow. I have identified two feature columns 1.Area & 2.Date, the output will be to predict a value.

I have around 10,000 rows of data. I am using pandas to split the data in training and test data.

# Read Csv Data for training
df = pd.read_csv('CultivatedSask.csv',encoding='latin1')
X, y = df.iloc[:,1:3],df.iloc[:,:1]

X_train, X_test, y_train, y_test = 
train_test_split(X,y,test_size=0.2,random_state=1)
X_train = X_train.as_matrix()
X_test = X_test.as_matrix()
y_train = y_train.as_matrix()
y_test = y_test.as_matrix()

These are the shapes for the variables X_train = (2232, 2) X_test = (559, 2) y_train = (2232, 1) y_test = (559, 1)

The data would look like this 10,000, 2015, $100,000

The goal would be to properly get the data in the right shape/format for my input nodes which would be placeholders.

链接地址: http://www.djcxy.com/p/32116.html

上一篇: Tensorflow DNN多重分类

下一篇: 将CSV特征解析为ANN的Tensorflow