I want to write the following algorithm in LaTeX:
V <- AllUnigramsInTraining(D)
N <- NumberOfTweets(D)
**for** each c ∈ C do
Nc <- Number of tweets in Class c
prior(c) <- [...]
Tweetsc <- All Tweets in class c
**for** each term t ∈ V do
Tct <- No. of times term t appeared in Tweetsc
**end for**
**for** each term t ∈ V do
prob[t][c] <- [...]
**end for**
**end for**
I wrote the following code but it is not compiling properly. Can anybody help?
\begin{algorithmic}
\STATE $V\gets AllUnigramsInTraining(D)$ \\
\STATE $N\gets NumberOfTweets(D)$ \\
\FOR each $c \in C$ \DO \\
\STATE $N_c\gets Number of tweets in Class c$ \\
\begin{equation}
prior(c) = \frac{N_c}{N} \\
\end{equation}
\STATE $Tweets_c\gets = All Tweets in class c$ \\
\FOR each term $t \in V$ \DO \\
T_ct = No. of times term t appeared in Tweets_c \\
\END
\FOR each term $t \in V$ \DO \\
\begin{equation}
$prob[t][c] = \frac{T_ct}{\sum_^t'{T_ct'+ 1}} \\
\end{equation}
\END
\END
\end{algorithmic}