Softmax function :The softmax function is used to highlight the highest values while suppress the other lowest values. Softmax function can also be corollorily understood as normalising the output to [0,1]

Converts the score array to perfect probabilities .For example, Let’s say, A record belongs to three classes  i.e class1, class2 and class 3 with the following score

scores = [1 , 2, 3]    =>      SOFTMAX FUNCTION = [0.16, 0.33, 0.5]
# The output has most of the weights where the value 3 is.

Softmax functions are the functions that are use to compute any score to probability.

1

Ref: Udacity

Python Codes for Softmax function:

scores = [3.0, 1.0, 0.2]

import numpy as np

def softmax(x):
"""Compute softmax values for each sets of scores in x."""
return np.exp(x) / sum(np.exp(x))

print(softmax(scores))

One-Hot Encoding: Is a process of translating the categorical feature into multi-space binary features e.g

AnimalId Type
1 Dog
2 Cat

TO

AnimalId Dog Cat
1 1 0
2 0 1
Advertisements