4

I am using python 3.5 with tensorflow 0.11 and sklearn 0.18. I wrote a simple example code to calculate the cross-validation score with iris data using tensorflow. I used the skflow as the wrapper.

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 like below. It seems that skflow is not compatible with cross_val_score of sklearn.

TypeError: Cannot clone object '' (type ): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.

Is there any other way to deal with this problem?

z991
  • 713
  • 1
  • 9
  • 21
  • This seems like a compatibility bug, or maybe a feature request. Try filing an issue at our [github](https://www.github.com/tensorflow/tensorflow/issues) page. – drpng Nov 09 '16 at 18:12
  • Thank you for your answer. It seems to be a bug, so I solved the problem by calculating mean score of 10 folds. – z991 Nov 10 '16 at 16:43

0 Answers0