def gen(self, normal_mu_range, anomaly_mu_range):
self.gens = [
compound_distribution(
stats.uniform(loc=anomaly_mu_range[0], scale=anomaly_mu_range[1] - anomaly_mu_range[0]),
truncated(stats.poisson, max_value=1024)
),
compound_distribution(
stats.uniform(loc=normal_mu_range[0], scale=normal_mu_range[1] - normal_mu_range[0]),
truncated(stats.poisson, max_value=1024)
)
]
self.priors = np.array([0.1, 0.9])
n = 100
m = 10
bins = 64
MC = CameraMC(self.priors, self.gens, image_shape=(1, n, ), n_frames=100, max_value=bins)
X = np.ndarray(shape=(m, n, bins), dtype='float32')
cats = np.ndarray(shape=(m, n), dtype='float32')
for i in xrange(m):
cats[i], _, imgs = MC.get_sample()
h = ndcount(imgs, bins=bins)
print h.shape
h = h.reshape(n, bins)
X[i] = h.astype('float32') / np.sum(h, axis=1)[:, None]
print("X shape %s" % (X.shape, ))
print("Categories shape %s" % (cats.shape, ))
self.X = X
self.cats = cats
评论列表
文章目录