Esempio n. 1
0
 def plot(self, dataDir, plotDir, files):
     n = len(files)  # number of bar pairs needed
     cmName = {
         'NoCountermeasure': 'No countermeasure',
         'AdditiveNoise': 'Additive noise',
         'Transfiguration': 'Transfiguration',
         'KAnonymity': 'K Anonymity',
         'KClustering': 'K Clustering'
     }
     width = 0.35
     pyf = PyFunctions()
     ic_random = []  # hold ic value of random queries
     ic_smart = []  # hold ic value of smart queries
     ctm = []
     for x in range(len(files)):
         try:
             path = dataDir + 'cmp_' + files[x] + '.txt'
             f = open(path, 'r')
             l = [map(float, line.split()) for line in f]
             avgl = pyf.average(l[1:])
             ic_random.append(avgl[len(avgl) - 1])
             path = dataDir + 'cmp_smart_' + files[x] + '.txt'
             f = open(path, 'r')
             l = [map(float, line.split()) for line in f]
             avgl = pyf.average(l[1:])
             ic_smart.append(avgl[len(avgl) - 1])
             ctm.append(cmName[files[x]])
         except Exception, e:
             continue
Esempio n. 2
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)
Esempio n. 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)
Esempio n. 4
0
	def plot(self, dataDir, plotDir, files):
		n = len(files) # number of bar pairs needed
		cmName = {'NoCountermeasure': 'No countermeasure', 'AdditiveNoise': 'Additive noise', 
			'Transfiguration': 'Transfiguration', 'KAnonymity': 'K Anonymity', 'KClustering': 'K Clustering'}
		width = 0.35
		pyf = PyFunctions()
		ic_random = []  # hold ic value of random queries
		ic_smart = []   # hold ic value of smart queries
		ctm = []
		for x in range(len(files)):	
			try:
				path = dataDir + 'cmp_' + files[x] + '.txt'
				f = open(path, 'r')
				l = [map(float, line.split()) for line in f]
				avgl = pyf.average(l[1:])
				ic_random.append(avgl[len(avgl) - 1])
				path = dataDir + 'cmp_smart_' + files[x] + '.txt'
				f = open(path, 'r')
				l = [map(float, line.split()) for line in f]
				avgl = pyf.average(l[1:])
				ic_smart.append(avgl[len(avgl) - 1])
				ctm.append(cmName[files[x]])
			except Exception, e:
				continue
Esempio n. 5
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)
Esempio n. 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)