Пример #1
0
	def getNoisyAnalysis(self,noise,err):
		exact=self.getAnalysis();
		m=len(exact);
		for i in range(0,m):
			pert=lap(scale=noise);
			while pert>err and err>0:
				pert=lap(scale=noise);
			exact[i]=exact[i]+pert;
		return exact;
Пример #2
0
 def getTrueValue(self):
     exact = self.analyser.getAnalysis()
     m = len(exact)
     for i in range(0, m):
         pert = lap(scale=self.noise)
         while abs(pert) > self.err and self.err > 0:
             pert = lap(scale=self.noise)
         exact[i] = exact[i] + pert
     self.truth = [i for i in exact]
     return [i for i in exact]
def lapLM(data, eps, m):
    lapv = lap(scale=(m / eps), size=len(data))
    loc_data = data + lapv
    loc_mean = np.mean(loc_data)
    return loc_mean
Пример #4
0
def lapLM(data, eps, m):
    lapv = lap(scale=(m / eps), size=len(data))
    loc_data = data + lapv
    loc_mean = np.mean(loc_data)
    # loc_mean = truncate(loc_mean, 0.0, 1.0)
    return loc_mean
Пример #5
0
def tcm(data, eps, m):
    tcm_mean = np.mean(data) + lap(scale=m / (len(data) * eps))
    # tcm_mean = truncate(tcm_mean, 0.0, 1.0)
    return tcm_mean