第20章敵対的生成ネットワーク
20.1.1. Generate Some “Real” Data20.1.1 「本物の」データを生成する
Since this is going to be the world’s lamest example, we simply generate data drawn from a Gaussian.
英語のヒント
これは世界で最もつまらない例になるので、単にガウス分布から抜き出したデータを生成する。
X = torch.normal(0.0, 1, (1000, 2))
A = torch.tensor([[1, 2], [-0.1, 0.5]])
b = torch.tensor([1, 2])
data = torch.matmul(X, A) + bLet’s see what we got. This should be a Gaussian shifted in some rather arbitrary way with mean and covariance matrix .
英語のヒント
何が得られたかを見よう。これは、平均と共分散行列をもつ、かなり任意のやり方でずらされたガウス分布になっているはずである。
d2l.set_figsize()
d2l.plt.scatter(data[:100, (0)].detach().numpy(), data[:100, (1)].detach().numpy());
print(f'The covariance matrix is\n{torch.matmul(A.T, A)}')The covariance matrix is
tensor([[1.0100, 1.9500],
[1.9500, 4.2500]])batch_size = 8
data_iter = d2l.load_array((data,), batch_size)