Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
TensorFlow & TF Learn : How to save logs for tensorboard visualization
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from sklearn import metrics, cross_validation
from tensorflow.contrib import learn
iris = learn.datasets.load_iris()
X_train, X_test, y_train, y_test = cross_validation.train_test_split(,, test_size=0.2, random_state=42)
classifier = learn.DNNClassifier(hidden_units=[10,20,10], n_classes=3, model_dir='./logs/model1'), y=y_train, steps=200)
print(metrics.accuracy_score(classifier.predict(X_test), y_test))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment