示例#1
0
    'ind', 'iden', 'uni', 'fdiff', 'fmax', 'fsum', 'buc_eq', 'buc_con',
    'buc_qeq', 'buc_qsd'
]
W_name = np.array([
    'adult', 'age1', 'age2', 'age3', 'Total', 'Total', 'Identity', 'Prefix',
    'Prefix'
])
W_lst = np.array([
    census.__adult(),
    census.__age1(),
    census.__age2(),
    census.__age3(),
    workload.Total(n),
    workload.Total(n),
    workload.Identity(n),
    workload.Prefix(n),
    workload.Prefix(n)
])
A_lst = strategy_comp(W_lst, n, rep)
results = []
names = []
total_errors = pd.DataFrame()
mean_ratio_errors = pd.DataFrame()
max_ratio_errors = pd.DataFrame()
min_ratio_errors = pd.DataFrame()
max_distances = pd.DataFrame()
min_distances = pd.DataFrame()
gini_coefficients = pd.DataFrame()
mean_idenratio_errors = pd.DataFrame()
max_idenratio_errors = pd.DataFrame()
min_idenratio_errors = pd.DataFrame()
示例#2
0
modes = ['ind', 'iden', 'uni', 'fsum', 'buc_qsd']

x_mean = np.sum(x_data[:, 0] * x_data[:, 1]) / np.sum(x_data[:, 1])
mid = np.sum(x_data[:, 1]) / 2
prefix = np.cumsum(x_data[:, 1])
x_median = x_data[np.searchsorted(prefix, mid), 0]
x_per = []
for percentile in [0.25, 0.75]:
    loc = np.sum(x_data[:, 1]) * percentile
    x_per.append(x_data[np.searchsorted(prefix, loc), 0])

meanW = np.vstack((x_data[:, 0], np.ones(n)))
meanW = matrix.EkteloMatrix(meanW)
W_name = np.array(['Mean', 'Median', 'Per_25', 'Per_75'])
W_lst = np.array(
    [meanW, workload.Prefix(n),
     workload.Prefix(n),
     workload.Prefix(n)])
A_lst = strategy_comp(W_lst, n, rep)
q_lst = W_name

ans_lst = np.array([x_mean, x_median] + x_per)
print(ans_lst)

results = []
names = []
ks = []
total_errors = pd.DataFrame()
max_ratio_errors = pd.DataFrame()
inters = pd.DataFrame()
示例#3
0
x_mean = np.sum(x_data[:,0]*x_data[:,1])/np.sum(x_data[:,1])
mid = np.sum(x_data[:,1])/2
prefix = np.cumsum(x_data[:,1])
x_median = x_data[np.searchsorted(prefix, mid),0]
x_mode = x_data[np.argmax(x_data[:,1]),0]
x_per = []
for percentile in [0.1, 0.25, 0.75, 0.9]:
    loc = np.sum(x_data[:,1])*percentile
    x_per.append(x_data[np.searchsorted(prefix, loc),0])


meanW = np.vstack((x_data[:,0], np.ones(n)))
meanW = matrix.EkteloMatrix(meanW)
W_name = np.array(['Mean', 'Median', 'Mode', 'Per_10', 'Per_25', 'Per_75', 'Per_90'])
W_lst = np.array([meanW, workload.Prefix(n), workload.Identity(n),workload.Prefix(n), workload.Prefix(n),workload.Prefix(n), workload.Prefix(n)])
A_lst = strategy_comp(W_lst, n, rep)
q_lst = W_name

ans_lst = np.array([x_mean, x_median, x_mode] + x_per)
print(ans_lst)

results = []
names = []
ks = []
total_errors = pd.DataFrame()
max_ratio_errors = pd.DataFrame()
inters = pd.DataFrame()

for i in range(t):
    print(i, flush=True)
示例#4
0
conf['rep'] = rep
conf['seed'] = seed
conf['t'] = t
conf['x_file'] = x_file
modes = ['ind', 'iden', 'uni', 'fsum', 'buc_qsd']

x_mean = np.sum(x_data[:, 0] * x_data[:, 1]) / np.sum(x_data[:, 1])
mid = np.sum(x_data[:, 1]) / 2
prefix = np.cumsum(x_data[:, 1])
x_median = x_data[np.searchsorted(prefix, mid), 0]
x_mode = x_data[np.argmax(x_data[:, 1]), 0]

meanW = np.vstack((x_data[:, 0], np.ones(n)))
meanW = matrix.EkteloMatrix(meanW)
W_name = np.array(['Mean', 'Median'])
W_lst = np.array([meanW, workload.Prefix(n)])
A_lst = strategy_comp(W_lst, n, rep)
q_lst = W_name

ans_lst = np.array([x_mean, x_median, x_mode])
print(ans_lst)

results = []
names = []
ks = []
total_errors = pd.DataFrame()
max_ratio_errors = pd.DataFrame()
inters = pd.DataFrame()

for i in range(t):
    print(i, flush=True)