How do I write the following algorithm/pseudocode in algorithm environment in Latex?
train_ANN(fi,wi,oj)
For epochs from 1 to N
While (j<=m)
Randomly initialize wi={w1,w2…..wn}
input oj={o1,o2…..om} in the input layer
forward propagate (fi*wi) through layers until getting the predicted result y
compute e=y-y^
back propagate e from right to left through layers
update wi
end
Best Answer
Observe the use of the keywords (uppercase essential!)
\STATE
,\FOR
and\ENDFOR
, and\WHILE
and\ENDWHILE
as well as of LaTeX math notation, e.g.,\le
in place of<=
,\dots
in place of…..
, and explicit subscript notation, e.g.,w_i
instead ofwi
. Finally, to display curly braces, use\{
and\}
, not{
and}
.