def main(unused_argv):
    training_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TRAINING, target_dtype=np.int, features_dtype=np.float32)
    test_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TEST, target_dtype=np.int, features_dtype=np.float32)
    feature_columns = [tf.contrib.layers.real_valued_column('', dimension=4)]
    validation_monitor = tf.contrib.learn.monitors.ValidationMonitor(test_set.data, test_set.target, every_n_steps=50)
    classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns, hidden_units=[10], n_classes=3, model_dir='/tmp/iris_model', config=tf.contrib.learn.RunConfig(save_checkpoints_secs=1))
    classifier.fit(x=training_set.data, y=training_set.target, steps=2000, monitors=[validation_monitor])
    accuracy_score = classifier.evaluate(x=test_set.data, y=test_set.target)['accuracy']
    print('Accuracy: {0:f}'.format(accuracy_score))
    new_samples = np.array([[6.4, 3.2, 4.5, 1.5], [5.8, 3.1, 5.0, 1.7]], dtype=np.float32)
    y = list(classifier.predict(new_samples, as_iterable=True))
    print('Predictions: {}'.format(str(y)))
def main(unused_argv):
    training_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TRAINING, target_dtype=np.int, features_dtype=np.float32)
    test_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TEST, target_dtype=np.int, features_dtype=np.float32)
    feature_columns = [tf.contrib.layers.real_valued_column(, dimension=4)]
    validation_monitor = tf.contrib.learn.monitors.ValidationMonitor(test_set.data, test_set.target, every_n_steps=50)
    classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns, hidden_units=[10], n_classes=3, model_dir='/tmp/iris_model', config=tf.contrib.learn.RunConfig(save_checkpoints_secs=1))
    classifier.fit(x=training_set.data, y=training_set.target, steps=2000, monitors=[validation_monitor])
    accuracy_score = classifier.evaluate(x=test_set.data, y=test_set.target)['accuracy']
    print('Accuracy: {0:f}'.format(accuracy_score))
    new_samples = np.array([[6.4, 3.2, 4.5, 1.5], [5.8, 3.1, 5.0, 1.7]], dtype=np.float32)
    y = list(classifier.predict(new_samples, as_iterable=True))
    print('Predictions: {}'.format(str(y)))