第12章最適化アルゴリズム
12.5.3. Reading the Dataset12.5.3 データセットを読む
Let’s have a look at how minibatches are efficiently generated from data. In the following we use a dataset developed by NASA to test the wing noise from different aircraft to compare these optimization algorithms. For convenience we only use the first examples. The data is whitened for preprocessing, i.e., we remove the mean and rescale the variance to per coordinate.
英語のヒント
データからミニバッチがどう効率よく生成されるかを見よう。以下では、これらの最適化アルゴリズムを比べるため、NASAが開発した、さまざまな航空機の翼の騒音をテストするためのデータセットを使う。便宜上、最初の個の事例だけを使う。前処理としてデータは白色化される。つまり、座標ごとに平均を取り除き、分散をに再スケールする。
#@save
d2l.DATA_HUB['airfoil'] = (d2l.DATA_URL + 'airfoil_self_noise.dat',
'76e5be1548fd8222e5074cf0faae75edff8cf93f')
#@save
def get_data_ch11(batch_size=10, n=1500):
data = np.genfromtxt(d2l.download('airfoil'),
dtype=np.float32, delimiter='\t')
data = torch.from_numpy((data - data.mean(axis=0)) / data.std(axis=0))
data_iter = d2l.load_array((data[:n, :-1], data[:n, -1]),
batch_size, is_train=True)
return data_iter, data.shape[1]-1