Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用TensorForestEstimator训练Tensorflow随机林时的类型错误_Python_Python 3.x_Machine Learning_Tensorflow_Random Forest - Fatal编程技术网

Python 使用TensorForestEstimator训练Tensorflow随机林时的类型错误

Python 使用TensorForestEstimator训练Tensorflow随机林时的类型错误,python,python-3.x,machine-learning,tensorflow,random-forest,Python,Python 3.x,Machine Learning,Tensorflow,Random Forest,当尝试使用TensorForestEstimator训练Tensorflow随机林时,我得到一个类型错误 TypeError: Input 'input_data' of 'CountExtremelyRandomStats' Op has type float64 that does not match expected type of float32. 我尝试过使用Python2.7和Python3,并且尝试过使用tf.cast()将所有内容放入float32中,但没有任何帮助。我已经检查

当尝试使用TensorForestEstimator训练Tensorflow随机林时,我得到一个类型错误

TypeError: Input 'input_data' of 'CountExtremelyRandomStats' Op has type float64 that does not match expected type of float32.
我尝试过使用Python2.7和Python3,并且尝试过使用tf.cast()将所有内容放入float32中,但没有任何帮助。我已经检查了执行时的数据类型,它是float32。问题似乎不是我提供的数据(所有浮动的csv),所以我不确定从这里走到哪里

任何我可以尝试的建议都将不胜感激

代码:


您使用tf.cast的方式不正确

tf.cast(training_set, tf.float32) #error occurs with/without casts
应该是

training_set = tf.cast(training_set, tf.float32)

tf.cast是就地方法,与任何其他操作一样,它是张量流op,需要分配和运行。

您好,我也遇到过类似问题,但此解决方案对我不起作用?我不确定我的问题是否与此相同?
training_set = tf.cast(training_set, tf.float32)