Kelvin Baumgart
Kelvin Baumgart

Reputation: 161

TensorFlow Iris load_csv_with_header( )

In the TensorFlow quick start tutorial which folder am I suppose to put the iris training/test csv files as to let me use this code. I'm specifically having problems using the load_csv_with_header module and being new to programming I'm at a lost when they say "Place these files in the same directory as your Python code." To my eyes there appears to be a several directories which may satisfy this but at last no results. I've also tried typing getcwd() into the interpreter but it says no module defined. I'm using python 2.7 with the most current version of andaconda to do this.

# Data sets
IRIS_TRAINING = "iris_training.csv"
IRIS_TEST = "iris_test.csv"

# Load datasets.
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)

Upvotes: 1

Views: 2064

Answers (1)

PraveenPalanisamy
PraveenPalanisamy

Reputation: 546

Let's say you have saved the tutorial code in your computer as tf_learn_tutorial.py in a folder named tutorial1. Then you should make sure you download and save the iris_training.csv file and iris_test.csv file in the same folder named tutorial1 where your .py file exists.

After which the folder tutorial1 on your computer should have (at least) these three files:

  • tf_learn_tutorial.py
  • iris_training.csv
  • iris_test.csv

To make it even simpler for you to quick start the tutorial,

Step 1: Download this file (tf_learn_tutorial.py) and save it as tf_learn_tutorial.py on your computer in a folder named tutorial1 anywhere on your hard disk as you like.

Step 2: Download this file (iris_training.csv) and save it on your computer in the same folder as above named tutorial1.

Step 3: Download this file (iris_test.csv) and save it on your computer in the same folder as above named tutorial1.

Step 4: Run the tf_learn_tutorial.py file from the tutorial1 directory:

python tf_learn_tutorial.py.

Upvotes: 1

Related Questions