データの正規化、様々な正則化手法、gradient descent with momentum や Adam などによる学習の高速化、batch-normalization、gradient checking、ハイパーパラメータチューニングの基本的な手法など。振り返ってみるとかなり盛り沢山な内容だった。jupyter notebook で手を動かすのは本当に勉強になる。
2020/09/25 開催の scala.tokyo で Things happening before start coding with Metals ~behind the curtain of daily coding~ という気取ったタイトルのLT(10分)をしました。
イベント主催の皆さん、21時を回っていたのに僕の発表を最後まで聞いてくれた人たち、本当にありがとうございました!
v.shape # (x, y, z, examples)
v_flattened = v.reshape(x * y * z, examples)
v_flattened # (x * y * z, examples)
# 0-th data を除いて flattening する# ドキュメントにも書いてないように見えるけど...?# The "-1" makes reshape flatten the remaining dimensions
ndarray.reshape(ndarray.shape[0], -1)
Axes are defined for arrays with more than one dimension. A 2-dimensional array has two corresponding axes: the first running vertically downwards across rows (axis 0), and the second running horizontally across columns (axis 1).
When operating on two arrays, NumPy compares their shapes element-wise. It starts with the trailing dimensions and works its way forward. Two dimensions are compatible when
1. they are equal, or
2. one of them is 1
a = np.array([[1, 2, 3],
[4, 5, 6]])
a + 1#[[2, 3, 4]# [5, 6, 7]]
b = np.array([[100],
[100]])
a + b
#[[101, 102, 103]# [104, 105, 106]]
vectorization
行列計算には numpy.dot 等を使い、explicit for-loop を使わない。
import numpy as np
a = np.random.rand(100000)
b = np.random.rand(100000)
c = np.dot(a, b)
# 早いし、ベクトルのサイズ増やしても速度は変わらない(O(1))# for loop だと O(N) の計算量になる。# numpy vectorization では内部で SIMD命令が(利用可能なら)使われるので高速