1616import theano .tensor as T
1717from theano .tensor .shared_randomstreams import RandomStreams
1818import pandas
19+ import matplotlib .pyplot as plt
20+ import matplotlib .cm as cm
1921
2022def logistic_transform (A , mu , sigma ):
2123 A [numpy .where (A == 0 )] = 0.1
@@ -63,14 +65,21 @@ def import_data(label, data_dir, image_dim):
6365 #if neutral.iloc[0]:
6466 if test_target >= - 1 :
6567 test_image = numpy .array (scipy .misc .imread (f ))
68+
6669 if (len (test_image .flatten ())!= (image_dim * image_dim )):
6770 continue
6871 #for i, row in enumerate(test_targets.iloc[0].values):
6972 # print i + str(test_targets.iloc[0][i])
7073
74+ #test_image2 = test_image.astype(float)
75+ #temp = logistic_transform(test_image2.flatten(), 140, 0.05)
76+ #plt.imshow(temp.reshape(image_dim,image_dim), cmap = cm.Greys_r)
77+ #plt.show()
78+ #plt.show(block=False)
79+
7180 if test_target > 50 :
7281 test_image2 = test_image .astype (float )
73- temp = logistic_transform (test_image2 .flatten (), 120 , 0.1 )
82+ temp = logistic_transform (test_image2 .flatten (), 140 , 0.05 )
7483 if numpy .isnan (temp ).any ():
7584 print "NaN found :("
7685 continue
@@ -79,7 +88,7 @@ def import_data(label, data_dir, image_dim):
7988 target = numpy .append (target , [1 ], axis = 0 )
8089 elif test_target == 0 :
8190 test_image2 = test_image .astype (float )
82- temp = logistic_transform (test_image2 .flatten (), 120 , 0.1 )
91+ temp = logistic_transform (test_image2 .flatten (), 140 , 0.05 )
8392 if numpy .isnan (temp ).any ():
8493 print "NaN found :("
8594 continue
@@ -88,7 +97,7 @@ def import_data(label, data_dir, image_dim):
8897 target = numpy .append (target , [0 ], axis = 0 )
8998 elif test_target == - 1 :
9099 test_image2 = test_image .astype (float )
91- temp = logistic_transform (test_image2 .flatten (), 120 , 0.1 )
100+ temp = logistic_transform (test_image2 .flatten (), 140 , 0.05 )
92101 if numpy .isnan (temp ).any ():
93102 print "NaN found :("
94103 continue
0 commit comments