How to write the arguments $y_{pred}=argmax_iP(Y=i|x,W,b)$ in MATLAB

84 Views Asked by At

I am working a syntax on Neural Network for multiclass (1, 2, 3, and 4) with SOFTMAX activation function in output class. As we know the SOFTMAX lassification is done by projecting data points onto a set of hyperplanes, the distance to which reflects a class membership probability.

Let weight matrix is $W$ and a bias vector $b$ so that $v_i=\Sigma (w_ix+b_i)$ or mathematically $P(Y=i|x,W,b)$ = $\frac{e^{w_ix+b_i}}{\Sigma(e^{(w_ix+b_i)}}$, this function then I said as my SOFTMAX activation function that I wrote in MATLAB is:

a=exp(vi)/sum(exp(vi))

So through this probability I want to make the code of the model’s prediction where mathematically $y_{pred}=argmax_iP(Y=i|x,W,b)$ where is the class whose probability is maximal.

My question is HOW to write the arguments $y_{pred}=argmax_iP(Y=i|x,W,b)$ in MATLAB code manually?

Many thanks for your help!