In [32]:
import tensorflow as tf
from os.path import dirname, realpath, join
import numpy as np

x=np.random.randint(100, size=25)
y=tf.Variable(5*(x**2)- 3*x + 15,name='y')
model=tf.global_variables_initializer()

In [33]:
dir=join(dirname(realpath(dirname(realpath(dirname('__file__'))))),'Files')
filename = dir + '/Olympics2016.csv'

In [34]:
features = tf.placeholder(tf.int32, shape=[3], name='features')
country = tf.placeholder(tf.string, name='country')
total = tf.reduce_mean(features,name='total')

In [35]:
printerop = tf.Print(total,[country,features,total], name='printer')

In [36]:
with tf.Session() as sess:
    sess.run(model)
    print(sess.run(y))
    with open(filename) as inf:
        next(inf)
        for line in inf:
            country_name, code, gold, silver, bronze, total= line.strip().split(",")
            gold=int(gold)
            silver=int(silver)
            bronze=int(bronze)
            total1=sess.run(printerop, feed_dict={features:[gold,silver,bronze], country:country_name})
            print(country_name,total1)


[22931 20303 21597 48723  1955 10919 35043 10457 14433 35885 17243 39353
 17835 41147 16089  9563 11873 14975  6387 35885 13379 22259 23613  4727
 20303]
"United States" 40
"Great Britain" 22
"China" 23
"Russia" 18
"Germany" 14
"Japan" 13
"France" 14
"South Korea" 7
"Italy" 9
"Australia" 9
"Netherlands" 6
"Hungary" 5
"Brazil" 6
"Spain" 5
"Kenya" 4
"Jamaica" 3
"Croatia" 3
"Cuba" 3
"New Zealand" 6
"Canada" 7
"Uzbekistan" 4
"Kazakhstan" 5
"Colombia" 2
"Switzerland" 2
"Iran" 2
"Greece" 2
"Argentina" 1
"Denmark" 5
"Sweden" 3
"South Africa" 3
"Ukraine" 3
"Serbia" 2
"Poland" 3
"North Korea" 2
"Belgium" 2
"Thailand" 2
"Slovakia" 1
"Georgia" 2
"Azerbaijan" 6
"Belarus" 3
"Turkey" 2
"Armenia" 1
"Czech Republic" 3
"Ethiopia" 2
"Slovenia" 1
"Indonesia" 1
"Romania" 1
"Bahrain" 0
"Vietnam" 0
"Chinese Taipei" 1
"Bahamas" 0
"Ivory Coast" 0
"Independent Olympic Athletes" 0
"Fiji" 0
"Jordan" 0
"Kosovo" 0
"Puerto Rico" 0
"Singapore" 0
"Tajikistan" 0
"Malaysia" 1
"Mexico" 1
"Algeria" 0
"Ireland" 0
"Lithuania" 1
"Bulgaria" 1
"Venezuela" 1
"India" 0
"Mongolia" 0
"Burundi" 0
"Grenada" 0
"Niger" 0
"Philippines" 0
"Qatar" 0
"Norway" 1
"Egypt" 1
"Tunisia" 1
"Israel" 0
"Austria" 0
"Dominican Republic" 0
"Estonia" 0
"Finland" 0
"Morocco" 0
"Moldova" 0
"Nigeria" 0
"Portugal" 0
"Trinidad and Tobago" 0
"United Arab Emirates" 0

In [ ]: