Skip to content

Commit

Permalink
Temporarily removed caffe2 onnx tutorial; load iris.data file into da…
Browse files Browse the repository at this point in the history
…ta folder in introduction to hybrid frontend tutorial
  • Loading branch information
Matthew Inkawhich authored and JoelMarcey committed Aug 29, 2018
1 parent 7a32b02 commit e98491e
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,19 @@
#

url = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data" # url to data
filename = url.split("/")[-1]
filename = os.path.join("data", url.split("/")[-1])

# Download file if it doesn't already exist
if not os.path.exists(filename):
os.makedirs("data")
print("Downloading...")
wget.download(url, 'iris.data')
wget.download(url, filename)
print("Download complete!")
else:
print("File exists, skipping download.")

# Print 10 random lines
with open(filename, 'rb') as datafile:
with open(filename, 'r') as datafile:
lines = datafile.readlines()
# Last line in file is empty, we'll deal with this later
lines = lines[:-1]
Expand All @@ -218,7 +219,7 @@

# Takes a filename with comma separated contents, returns dataset list
def create_dataset(filepath):
with open(filepath, 'rb') as datafile:
with open(filepath, 'r') as datafile:
# Create dataset list
lines = csv.reader(datafile)
dataset = list(lines)
Expand All @@ -233,7 +234,7 @@ def create_dataset(filepath):


# Load dataset
dataset = create_dataset("iris.data")
dataset = create_dataset("data/iris.data")


######################################################################
Expand Down

0 comments on commit e98491e

Please sign in to comment.