我认为TFlearn的evaluate方法返回模型的精度(0到1),但在训练我的模型后,model.evaluate(test_x, test_y)返回值>1 (1.003626),所以现在我不确定我确切地理解了它返回的内容。
有谁能解释一下吗?
发布于 2016-12-16 02:19:46
evaluate方法返回一个dict,因此调用应该是
model.evaluate(test_x, test_y)['accuracy']
但我猜这不是问题所在。如果您正在进行分类,则测试标签必须是整数才能工作。除此之外,如果看不到更多的代码,就很难进行调试。
来自evaluate源代码的注释:
Args: x: Matrix of shape [n_samples, n_features...] or dictionary of many matrices containing the input samples for fitting the model. Can be iterator that returns arrays of features or dictionary of array of features. If set,input_fnmust beNone. y: Vector or matrix [n_samples] or [n_samples, n_outputs] containing the label values (class labels in classification, real numbers in regression) or dictionary of multiple vectors/matrices. Can be iterator that returns array of targets or dictionary of array of targets. If set, input_fn must beNone. Note: For classification, label values must be integers representing the class index (i.e. values from 0 to n_classes-1).
https://stackoverflow.com/questions/41165408
复制相似问题