<jupyter_start><jupyter_text>TorchDaily   Today We will Learn About SoftMax Activation Function(SMAF)  First things first * whats an Activation Function:-In Lay man Lang. I can Say Its something which decides whether a neuron of a NN will fire or not,then applies a non-linear transformation to the output of the Neuron ..* In Terms of AF's:some of my favourite are -1.sigmoid2.ReLu3.Leaky ReLu4.softmax which we will discuss todayI Will Soon Bring a NB on DIfferent AF's  The SMAF Takes in input from a NN layer and converts them into probabilites .As You have seen from the image below the entry with the highest value will have the highest probability.Thats it this is what softmax doesIt takes in input of An Array and converts them into probabilities all you have to do is to take np.argmax(if an array) of it  ![dump.png](attachment:dump.png)<jupyter_code># Lets Get to the Numpy Version CODE! of it
import numpy as np

def softmax(array):
    return np.exp(array)/np.sum(np.exp(array))
array = np.array([2,1.0,0.1],dtype=np.float32)
output = softmax(array)
print(f'output: {output}')<jupyter_output>output: [0.6590011  0.24243295 0.09856589]<jupyter_text>well you see that just what it is , if you need the max of the output's too then just use np.argmax<jupyter_code>array[np.argmax(output)]
# Torch Version of the Softmax Looks different 
import torch 
array = torch.tensor([2,1,0.1],dtype=torch.float32)
loss = torch.softmax(array,dim=0)
print(f'loss: {loss}')<jupyter_output>loss: tensor([0.6590, 0.2424, 0.0986])
{'fraction_non_alphanumeric': 0.08792650918635171, 'fraction_numerical': 0.03871391076115486, 'mean_word_length': 5.027667984189724, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '362926', 'license': 'Apache-2.0', 'n_tokens_mistral': 531, 'n_tokens_neox': 490, 'n_words': 197, 'path': 'SoftMax Interpretation.ipynb', 'repo_name': 'shyamgupta196/LearningPyTorch', 'size': '1524'}