Python 3.x 还原TensorFlow中的图形-还原Tensor中的值

Python 3.x 还原TensorFlow中的图形-还原Tensor中的值,python-3.x,search,tensorflow,neural-network,restore,Python 3.x,Search,Tensorflow,Neural Network,Restore,我建立了一个人工神经网络来预测数值​​对于人寿保险数据。当我恢复图形时,我可以导入我的预测张量以查看我的值 sess = tf.Session() new_saver = tf.train.import_meta_graph('model.ckpt.meta') new_saver.restore(sess, tf.train.latest_checkpoint('./')) graph = tf.get_default_graph() inputs = graph.get_tensor_by_

我建立了一个人工神经网络来预测数值​​对于人寿保险数据。当我恢复图形时,我可以导入我的预测张量以查看我的值

sess = tf.Session()
new_saver = tf.train.import_meta_graph('model.ckpt.meta')
new_saver.restore(sess, tf.train.latest_checkpoint('./'))
graph = tf.get_default_graph()
inputs = graph.get_tensor_by_name("inputs:0")
predict_restore = graph.get_tensor_by_name("predicted:0")
train_data = pd.read_csv(r"C:\...\tensorflow-1.3.1\tensorflow\train_titanic.csv")
train_predict_restore = train_data.drop(["Survived"], axis=1)
feed_dict={inputs:train_predict_restore}
prob =sess.run(predict_restore,feed_dict)
在提要中,我将client的属性放在张量输入中。现在我想构建一个输入客户属性的函数,我去寻找他们各自的生存概率(prob)。tensorflow中有一个函数可以搜索张量中的一个或多个值?(在我的情况下,张量输入)

我相信训练预测恢复的形状是[num\u customers attributes]。因此,train\u predict\u restore[i]代表第i个客户

你可以这样做

feed_dict={inputs:[train_predict_restore[i]]}//changed train_predict_restore to [train_predict_restore[i]]
prob =sess.run(predict_restore,feed_dict)
这里,输出是第i个客户的概率值

希望这能有所帮助。

我相信列车预测恢复的形状是[num\u customers attributes]。因此,train\u predict\u restore[i]代表第i个客户

你可以这样做

feed_dict={inputs:[train_predict_restore[i]]}//changed train_predict_restore to [train_predict_restore[i]]
prob =sess.run(predict_restore,feed_dict)
这里,输出是第i个客户的概率值


希望这有帮助。

谢谢您的回答。我的问题不是通过train_predict_restore提取概率,而是构建一个函数来输入客户的属性,我去寻找它们各自的概率。我把这个属性放在我的第一个会话中的一个输入张量中。也许我可以使用查找功能,因为我不明白它是如何工作的。谢谢你的回答。我的问题不是通过train_predict_restore提取概率,而是构建一个函数来输入客户的属性,我去寻找它们各自的概率。我把这个属性放在我的第一个会话中的一个输入张量中。也许我可以使用查找功能,因为我不明白它是如何工作的。