ベクトルの大きさを1.0に近づける勾配
2023/9/7 1:07:00
$$ L = (\sum^{N}_{i=1}(X_i^2) - 1)^2 $$
$$ \frac{\partial L}{\partial X_i} = \frac{\partial (\sum^{N}_{i=1} (X_i^2) - 1)^2}{\partial X_i} $$
$$ = \frac{\partial (\sum^{N}_{i=1}(X_i^2) - 1)^2 }{\partial (\sum^{N}_{i=1}(X_i^2) - 1)} \frac{\partial (\sum^{N}_{i=1}(X_i^2) - 1)}{\partial X_i} $$
$$ = 2(\sum^{N}_{i=1}(X_i^2) - 1) (2 X_i) $$
$$ = 4X_i( \sum^{N}_{i=1}(X_i^2) - 1 ) $$