我在jupyter笔记本中使用tensorflow。我有一些我训练过的数据。数据格式如下
0 0
1 0
2 0
3 0
4 0
现在我在使用线性分类器后预测这种形式的值
[{'class_ids': array([1], dtype=int64),
'classes': array([b'1'], dtype=object),
'logits': array([ -0.88531315, 12.51075077, -14.0423975 , 2.56915855], dtype=float32),
'probabilities': array([ 1.52104417e-06, 9.99950290e-01, 2.93827636e-12,
4.81282150e-05], dtype=float32)},
{'class_ids': array([3], dtype=int64),
'classes': array([b'3'], dtype=object),
'logits': array([ 6.42214537, 21.82447243, -13.30796623, 23.08537292], dtype=float32),
'probabilities': array([ 4.51742359e-08, 2.20818907e-01, 1.21958252e-16,
7.79181063e-01], dtype=float32)},
{'class_ids': array([2], dtype=int64),
'classes': array([b'2'], dtype=object),
'logits': array([ 27.05874252, -58.91906357, 48.28507996, -113.13697052], dtype=float32),
'probabilities': array([ 6.04670480e-10, 0.00000000e+00, 1.00000000e+00,
0.00000000e+00], dtype=float32)},
现在我想把它们画在图上。问题是由于这个错误,我不能这样做
TypeError: float() argument must be a string or a number, not 'dict'
我怎样才能解决这个问题。 这是我正在使用的代码
pred_inpuy_func = tf.estimator.inputs.pandas_input_fn(x=testCal,
batch_size=10,
num_epochs=1,
shuffle=False)
predictions = model.predict(pred_inpuy_func)
Latest_Pred = list(predictions)
import matplotlib.pyplot as pt
%matplotlib inline
pt.plot(y_test,my_pred,".")
目前没有回答
相关问题 更多 >
编程相关推荐