第4章分類のための線形ニューラルネットワーク
4.4. Softmax Regression Implementation from Scratch4.4 ソフトマックス回帰のゼロからの実装
Because softmax regression is so fundamental, we believe that you ought to know how to implement it yourself. Here, we limit ourselves to defining the softmax-specific aspects of the model and reuse the other components from our linear regression section, including the training loop.
英語のヒント
ソフトマックス回帰はとても基本的なので、自分で実装する方法を知っておくべきだと考える。ここでは、モデルのうちソフトマックスに特有の部分を定義するだけにとどめ、訓練ループを含むほかの部品は線形回帰の節のものを使い回す。
import torch
from d2l import torch as d2l