Example #1
0
	def plot_random(self, dataDir, plotDir, files):
		output = plotDir
		pyf = PyFunctions()
		for x in range(len(files)):
			path = dataDir + files[x]
			try:
				f = open(path, 'r')
			except Exception, e:
				continue
			l = [map(float, line.split()) for line in f]
			if files[x] == 'cmp_NoCountermeasure.txt':
				label = "No countermeasure"
				marker = '.'
			elif files[x] == 'cmp_AdditiveNoise.txt':
				label = "Additive noise"
				marker = "*"
			elif files[x] == 'cmp_Transfiguration.txt':
				label = "Transfiguration"
				marker = "o"
			elif files[x] == 'cmp_KAnonymity.txt':
				label = "K anonymity"
				marker = "^"
			elif files[x] == 'cmp_KClustering.txt':
				label = "K clustering"
				marker = "D"
			plt.plot(l[0], pyf.normalize(pyf.average(l[1:])), label = label, marker = marker)
Example #2
0
 def plot(self, dataDir, plotDir, files):
     output = plotDir
     pyf = PyFunctions()
     for x in range(len(files)):
         path = dataDir + files[x]
         try:
             f = open(path, 'r')
         except Exception, e:
             continue
         l = [map(float, line.split()) for line in f]
         if files[x] == 'traddOff_KAnonymity.txt':
             title = "Trade-off bar of k anonymity"
         elif files[x] == 'traddOff_KClustering.txt':
             title = "Trade-off bar of k clustering"
         plt.figure()
         plt.bar([k - 0.25 for k in l[0]],
                 pyf.normalize(l[1]),
                 0.5,
                 color='g')
         plt.xticks(map(int, l[0]))
         plt.yticks([0.1 * i for i in range(1, 12)])
         plt.title(title)
         plt.xlabel('k')
         plt.ylabel('IC')
         plt.tight_layout()
         # plt.show()
         plt.savefig(output + files[x].replace('txt', 'png'))
Example #3
0
 def plot_random(self, dataDir, plotDir, files):
     output = plotDir
     pyf = PyFunctions()
     for x in range(len(files)):
         path = dataDir + files[x]
         try:
             f = open(path, 'r')
         except Exception, e:
             continue
         l = [map(float, line.split()) for line in f]
         if files[x] == 'cmp_NoCountermeasure.txt':
             label = "No countermeasure"
             marker = '.'
         elif files[x] == 'cmp_AdditiveNoise.txt':
             label = "Additive noise"
             marker = "*"
         elif files[x] == 'cmp_Transfiguration.txt':
             label = "Transfiguration"
             marker = "o"
         elif files[x] == 'cmp_KAnonymity.txt':
             label = "K anonymity"
             marker = "^"
         elif files[x] == 'cmp_KClustering.txt':
             label = "K clustering"
             marker = "D"
         plt.plot(l[0],
                  pyf.normalize(pyf.average(l[1:])),
                  label=label,
                  marker=marker)
Example #4
0
	def plot(self, dataDir, plotDir, files):
		output = plotDir
		pyf = PyFunctions()
		for x in range(len(files)):
			path = dataDir + files[x]
			try:
				f = open(path, 'r')
			except Exception, e:
				continue
			plt.figure()
			l = [map(float, line.split()) for line in f]
			if files[x] == 'traddOff_smart_AdditiveNoise.txt':
				title = "Trade-off curve of additive noise with smart queries"
				xlabel = 'Noise level'
			elif files[x] == 'traddOff_smart_Transfiguration.txt':
				title = "Trade-off curve of transfiguration with smart queries"
				xlabel = 'Number of sides'
				plt.xticks(map(int, l[0]))
			plt.plot(l[0], pyf.normalize(l[1]))
			plt.legend()
			plt.title(title)
			plt.xlabel(xlabel)
			plt.ylabel('IC')
			plt.tight_layout()
			plt.savefig(output + files[x].replace('txt', 'png'))
	def plot_random_smart(self, dataDir, plotDir, files):
		output = plotDir
		pyf = PyFunctions()
		for x in range(len(files)):
			path = dataDir + files[x]
			try:
				f = open(path, 'r')
			except Exception, e:
				continue
			l = [map(float, line.split()) for line in f]
			if files[x] == 'cmp_NoCountermeasure.txt':
				label = "Random queries"
				marker = '.'
			elif files[x] == 'cmp_smart_NoCountermeasure.txt':
				label = "Smart qeuries"
				marker = "*"
			plt.plot(l[0], pyf.normalize(pyf.average(l[1:])), label = label, marker = marker)
Example #6
0
 def plot_random_smart(self, dataDir, plotDir, files):
     output = plotDir
     pyf = PyFunctions()
     for x in range(len(files)):
         path = dataDir + files[x]
         try:
             f = open(path, 'r')
         except Exception, e:
             continue
         l = [map(float, line.split()) for line in f]
         if files[x] == 'cmp_NoCountermeasure.txt':
             label = "Random queries"
             marker = '.'
         elif files[x] == 'cmp_smart_NoCountermeasure.txt':
             label = "Smart qeuries"
             marker = "*"
         plt.plot(l[0],
                  pyf.normalize(pyf.average(l[1:])),
                  label=label,
                  marker=marker)
Example #7
0
	def plot(self, dataDir, plotDir, files):
		output = plotDir
		pyf = PyFunctions()
		for x in range(len(files)):
			path = dataDir + files[x]
			try:
				f = open(path, 'r')
			except Exception, e:
				continue
			l = [map(float, line.split()) for line in f]
			if files[x] == 'traddOff_smart_KAnonymity.txt':
				title = "Trade-off bar of k anonymity with smart queries"
			elif files[x] == 'traddOff_smart_KClustering.txt':
				title = "Trade-off bar of k clustering with smart queries"
			plt.figure()
			plt.bar([k - 0.25 for k in l[0]], pyf.normalize(l[1]), 0.5, color = 'g')
			plt.xticks(map(int, l[0]))
			plt.yticks([0.1 * i for i in range(1, 12)])
			plt.title(title)
			plt.xlabel('k')
			plt.ylabel('IC')
			plt.tight_layout()
			# plt.show()
			plt.savefig(output + files[x].replace('txt', 'png'))