from src.good_radius import find
from numpy.random import normal
import numpy as np
import time
from numpy import round
from __non_private_cluster__ import find_cluster


sample_number = 2**11
center = 100
data_2d = round(normal(center, 50, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))
domain, goal_number = (domain_end, 1), 1000
failure, eps, delta = 0.1, 0.5, 2**-20

r, c = find_cluster(data_2d, goal_number)
print "non-private radius : %d " % r
start_time = time.time()
result = find(data_2d, domain, goal_number, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in data_2d if np.linalg.norm(i - (center, center)) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball
start_time = time.time()
result = find(data_2d, domain, goal_number, failure, eps, False)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in data_2d if np.linalg.norm(i - (center, center)) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball

Exemple #2
0
import matplotlib.pyplot as plt
import time
from numpy import round
from scipy.spatial.distance import euclidean


sample_number, k, r = 2**12, 2, 4
center = 100
data_2d = round(normal(center, 50, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))

start_time = time.time()

domain, desired_amount_of_points = (domain_end, 1), 2000
approximation, failure, eps, delta, promise = 0.1, 0.1, 0.5, 2 ** -20, 100
radius = gr.find(data_2d, domain, desired_amount_of_points, failure, eps)
print "the radius: %d" % radius
middle_time = time.time()
print "good-radius run-time: %.2f seconds" % (middle_time - start_time)
center = gc.find(data_2d, sample_number, 2, radius, desired_amount_of_points, failure, approximation, eps, delta)
print "the center: %s" % str(center)
print "good-center run-time: %.2f seconds" % (time.time() - middle_time)
ball = [p for p in data_2d if euclidean(p, center) <= radius]
print "number of points in the resulting ball: %d" % len(ball)

zipped_data = zip(*data_2d)
plt.scatter(*zipped_data, c='b')
zipped_ball = zip(*ball)
plt.scatter(*zipped_ball, c='r')
plt.show()
Exemple #3
0
from __future__ import division
from numpy import array, vstack, round
from numpy.random import normal, randn
import time
from numpy.linalg import norm
from src.good_radius import find
from __non_private_cluster__ import find_cluster
import numpy as np

sample_number, k, r = 2**12, 2, 4
center = 100
data_2d = round(normal(center, 1, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))
domain = domain_end, 1
goal_number, failure, eps, delta, promise = 1000, 0.1, 0.5, 2**-20, 300
point = randn(1, 2)
singular = array([point[0]] * 1000)
data = vstack((data_2d, singular))

r, c = find_cluster(data_2d, goal_number)
print "non-private radius : %d " % r
start_time = time.time()
result = find(data, domain, goal_number, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in data if norm(i - point) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball
Exemple #4
0
import time
from __non_private_cluster__ import find_cluster
import sklearn.datasets as dss

sample_number = 3000
dimension, domain = 3, (0, 100)
blobs = dss.make_blobs(sample_number, dimension, cluster_std=70)
blob = blobs[0]

desired_amount_of_points, approximation, failure, eps, delta, promise = 1000, 0.1, 0.1, 0.5, 2**-10, 70

r, c = find_cluster(blob, desired_amount_of_points)
print r

start_time = time.time()
result = find(blob, domain, desired_amount_of_points, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len(
    [i for i in blob if np.linalg.norm(i - (c, c)) < result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball

start_time = time.time()
result = find2(blob, domain, desired_amount_of_points, failure, eps, delta,
               promise)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len(
    [i for i in blob if np.linalg.norm(i - (c, c)) < result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball
import time
from __non_private_cluster__ import find_cluster
import sklearn.datasets as dss


sample_number = 3000
dimension, domain = 3, (0, 100)
blobs = dss.make_blobs(sample_number, dimension, cluster_std=70)
blob = blobs[0]

desired_amount_of_points, approximation, failure, eps, delta, promise = 1000, 0.1, 0.1, 0.5, 2**-10, 70

r, c = find_cluster(blob, desired_amount_of_points)
print r

start_time = time.time()
result = find(blob, domain, desired_amount_of_points, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in blob if np.linalg.norm(i - (c, c)) < result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball

start_time = time.time()
result = find2(blob, domain, desired_amount_of_points, failure, eps, delta, promise)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in blob if np.linalg.norm(i - (c, c)) < result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball


from src.good_radius import find
from numpy.random import normal
import numpy as np
import time
from numpy import round
from __non_private_cluster__ import find_cluster

sample_number = 2**11
center = 100
data_2d = round(normal(center, 50, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))
domain, goal_number = (domain_end, 1), 1000
failure, eps, delta = 0.1, 0.5, 2**-20

r, c = find_cluster(data_2d, goal_number)
print "non-private radius : %d " % r
start_time = time.time()
result = find(data_2d, domain, goal_number, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len(
    [i for i in data_2d if np.linalg.norm(i - (center, center)) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball
start_time = time.time()
result = find(data_2d, domain, goal_number, failure, eps, False)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len(
    [i for i in data_2d if np.linalg.norm(i - (center, center)) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball
Exemple #7
0
import numpy as np
import matplotlib.pyplot as plt
import time
from numpy import round
from scipy.spatial.distance import euclidean

sample_number, k, r = 2**12, 2, 4
center = 100
data_2d = round(normal(center, 50, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))

start_time = time.time()

domain, desired_amount_of_points = (domain_end, 1), 2000
approximation, failure, eps, delta, promise = 0.1, 0.1, 0.5, 2**-20, 100
radius = gr.find(data_2d, domain, desired_amount_of_points, failure, eps)
print "the radius: %d" % radius
middle_time = time.time()
print "good-radius run-time: %.2f seconds" % (middle_time - start_time)
center = gc.find(data_2d, sample_number, 2, radius, desired_amount_of_points,
                 failure, approximation, eps, delta)
print "the center: %s" % str(center)
print "good-center run-time: %.2f seconds" % (time.time() - middle_time)
ball = [p for p in data_2d if euclidean(p, center) <= radius]
print "number of points in the resulting ball: %d" % len(ball)

zipped_data = zip(*data_2d)
plt.scatter(*zipped_data, c='b')
zipped_ball = zip(*ball)
plt.scatter(*zipped_ball, c='r')
plt.show()
from __future__ import division
from numpy import array, vstack, round
from numpy.random import normal, randn
import time
from numpy.linalg import norm
from src.good_radius import find
from __non_private_cluster__ import find_cluster
import numpy as np


sample_number, k, r = 2**12, 2, 4
center = 100
data_2d = round(normal(center, 1, (sample_number, 2)))
domain_end = max(abs(np.min(data_2d)), np.max(data_2d))
domain = domain_end, 1
goal_number, failure, eps, delta, promise = 1000, 0.1, 0.5, 2**-20, 300
point = randn(1, 2)
singular = array([point[0]]*1000)
data = vstack((data_2d, singular))

r, c = find_cluster(data_2d, goal_number)
print "non-private radius : %d " % r
start_time = time.time()
result = find(data, domain, goal_number, failure, eps)
print "run-time: %.2f seconds" % (time.time() - start_time)
print "good radius : %d " % result
points_in_resulting_ball = len([i for i in data if norm(i - point) <= result])
print "number of points in the resulting ball : %d" % points_in_resulting_ball