<jupyter_start><jupyter_text>Initializing Model Parameters<jupyter_code># initialize the weights at random with zero mean and standard deviation 0.01
net = nn.Sequential()
net.add(nn.Dense(10))
net.initialize(init.Normal(sigma=0.01))<jupyter_output><empty_output><jupyter_text>Softmax Implementation Revisited<jupyter_code># pass the logits and compute the softmax and its log
loss = gluon.loss.SoftmaxCrossEntropyLoss()<jupyter_output><empty_output><jupyter_text>Optimization Algorithm<jupyter_code># use minibatch stochastic gradient descent with a learning rate of 0.1 as the optimization algorithm
trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.1})<jupyter_output><empty_output><jupyter_text>Training<jupyter_code>!pip uninstall matplotlib
!pip install --upgrade matplotlib
# call the training function
num_epochs = 10
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, trainer)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09820485744456177, 'fraction_numerical': 0.01689545934530095, 'mean_word_length': 9.193548387096774, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '650877', 'license': 'Unlicense', 'n_tokens_mistral': 337, 'n_tokens_neox': 314, 'n_words': 72, 'path': 'Week 9/3.7. Concise Implementation of Softmax Regression.ipynb', 'repo_name': 'Hanif-2610/Machine-Learning-Homework-Project', 'size': '947'}