Cross_val_score does not work with tensor flow (skflow)

I am using python 3.5 with tensor flow 0.11 and sklearn 0.18. I wrote a simple sample code to compute a cross-validation score using aperture data using a tensor flow. I used skflow as a shell.

import tensorflow.contrib.learn as skflow
from sklearn import datasets
from sklearn import cross_validation
iris=datasets.load_iris()
feature_columns = skflow.infer_real_valued_columns_from_input(iris.data)
classifier = skflow.DNNClassifier(hidden_units=[10, 10, 10], n_classes=3, feature_columns=feature_columns)
print(cross_validation.cross_val_score(classifier, iris.data, iris.target, cv=2, scoring = 'accuracy'))

But I got an error as shown below. It seems that skflow is not compatible with cross_val_score sklearn.

TypeError: cannot clone an object '' (type): it does not seem to be a scikit-learn evaluation score since it does not implement get_params methods.

Is there any other way to deal with this problem?

+4
source share

Source: https://habr.com/ru/post/1660162/


All Articles