小编tgs*_*266的帖子

如何在Tensorflow中输出预测?

我正在尝试使用Tensorflow DNN进行Kaggle Competion .数据大约有100列分类数据,29列数值数据和1列输出.我做的是使用Scikit的列车测试分割函数将其分为训练和使用X和y进行测试,其中X是没有"id"的每行的列表或需要预测的值,y是值需要预测.然后我构建了模型,如下所示:

import tensorflow as tf
import numpy as np
import time
import pickle
with open('pickle.pickle', 'rb') as f:
    trainX, trainy, testX, testy = pickle.load(f)
trainX = np.array(trainX)
trainy = np.array(trainy)
trainy = trainy.reshape(trainy.shape[0], 1)
testX = np.array(testX)
testy = np.array(testy)
print (trainX.shape)
print (trainy.shape)
testX = testX.reshape(testX.shape[0], 130)
testy = testy.reshape(testy.shape[0], 1)
print (testX.shape)
print (testy.shape)
n_nodes_hl1 = 256
n_nodes_hl2 = 256
n_nodes_hl3 = 256

n_classes = 1

batch_size = 100


# Matrix = h X …
Run Code Online (Sandbox Code Playgroud)

neural-network python-3.x tensorflow

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

neural-network ×1

python-3.x ×1

tensorflow ×1