-
Notifications
You must be signed in to change notification settings - Fork 0
/
DatasetGeneration.py
40 lines (25 loc) · 1.1 KB
/
DatasetGeneration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import numpy as np
import pandas as pd
import random
from quantile_filtration import quantile
random.seed(99846)
np.random.seed(99846)
def generate_data_clouds(points_for_cloud,num_diag_per_class,r_values): # generating a list of data clouds (var points), with it's corresponding list of 10 percentiles
labels = []
points=[]
random.seed(99846)
np.random.seed(99846)
for r in r_values:
for _ in range(num_diag_per_class):
X = np.empty([points_for_cloud, 2])
x, y = np.random.uniform(), np.random.uniform()
for i in range(points_for_cloud):
X[i, :] = [x, y]
x = (X[i, 0] + r * X[i, 1] * (1 - X[i, 1])) % 1
y = (X[i, 1] + r * x * (1 - x)) % 1
points.append(X)
labels.append([str(r)])
thresh = [quantile(element) for element in points]
thresh_array = np.array(thresh)
quantiles= np.mean(thresh_array, axis=0)
return (points,labels,quantiles)