i=0; i
{(vec [i]> 200)
{max; maxIndex; (vec, & max, & maxIndex, len); (j=0; j
{if (j == maxIndex) vec [j]=1.0; vec [j]=0.0;
};
}
{[i]=exp (vec [i]);
} +=vec [i];
} (sum == 0)
{a=1;
} (sum!=0.0)
{(i=0; i
} for (i=0; i
} logistic (double x)
{(x> 100.0) x=1.0; if (x <- 100.0) x=0.0; x=1.0 / (1.0 + exp (-x)); x;
} ComputeFeedForwardSignals (double * MAT_INOUT, double * V_IN, double * V_OUT, double * V_BIAS, int size1, int size2, int layer)
{row, col; (row=0; row
{_OUT[row]=0.0;(col=0;col<size1;col++)V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)*V_IN[col]);_OUT[row]+=V_BIAS[row];(layer==0) V_OUT [row]=logistic (V_OUT [row]);
}
} RunNeuralNet_Classification ()
{((double *) input_hidden_weights, input, hidden, hidden_bias, 12, 5,0); ((double *) hidden_output_wts, hidden, output, output_bias, 5, 3,1);
} main ()
{index; i=0; keyin=1; max; (1)
{= 3.e - 300; (« nEnter values ??for Continuous inputs n"); («Cont. Input - 0 (Var1):"); («% lg », & input [0]); (« Cont. Input - 1 (Var2):" ); («% lg », & input [1]); (« Cont. Input - 2 (Var3):" ); («% lg », & input [2]); (« Cont. Input - 3 (Var4):" ); («% lg », & input [ 3]); («Cont. Input - 4 (Var5):"); («% lg», & input [4]); («Cont. Input - 5 (Var6):») ; («% lg», & input [5]); («Cont. Input - 6 (Var7):"); («% lg», & input [6]); (« Cont. Input - 7 (Var8):" ); («% lg », & input [7]); (« Cont. Input - 8 (Var9):" ); («% lg » , & input [8]); («Cont. Input - 9 (Var10):"); («% lg», & input [9]); («Cont. Input - 10 (Var11 ):" ); («% lg », & input [10]); (« Cont. Input - 11 (Var12):" ); («% lg », & input [11] ); (input, 0,1,12); _Classification ();
/ / Output Activation is Softmax; (output, 3); (i=0; i <3; i + +)
{(max
{= output [i];=i +1;
}
} (« nPredicted category =»); (index)
{1: printf ("A n"); break; 2: printf ("B n"); break; 3: printf ("C n"); break;: break;
} (« nConfidence level =% .14 f», max); (« n nPress any key to make another prediction or enter 0 to quit the program. n"); =getch (); (keyin == 48) break;
} 0;
}