鸢尾花;来自过时的库的警告;代码需要永远执行

时间:2019-05-08 12:56:13

标签: python-3.x tensorflow scikit-learn

我正在尝试实现分类器-鸢尾花-经典问题

我正在使用Python3.6

代码

import tensorflow as tf

from sklearn import datasets, metrics
from tensorflow.contrib.learn.python import SKCompat

iris = datasets.load_iris()

classifier = SKCompat(tf.contrib.learn.LinearClassifier(
    feature_columns=[tf.contrib.layers.real_valued_column("",dimension=iris.data.shape[1])],
    n_classes=3))
classifier.fit(iris.data, iris.target)
score = metrics.accuracy_score(iris.target,classifier.predict(iris.data))

print("Accuracy: %f" %score)

错误消息:


Instructions for updating:
Please use tensorflow/transform or tf.data.

check_array (from tensorflow.contrib.learn.python.learn.learn_io.data_feeder) is deprecated and will be removed in a future version.

Instructions for updating:
Please convert numpy dtypes explicitly.

WARNING:tensorflow:float64 is not supported by many models, consider casting to float32.

ModelFnOps.__new__ (from tensorflow.contrib.learn.python.learn.estimators.model_fn) is deprecated and will be removed in a future version.

Instructions for updating:
When switching to tf.estimator.Estimator, use tf.estimator.EstimatorSpec. You can use the `estimator_spec` method to create an equivalent one.

让我知道是否需要延长的错误代码。如果需要,我将其添加。

0 个答案:

没有答案