Click here to Skip to main content
15,885,668 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
This is MultiNomial NaiveBayes Pseudocode .

TRAINMULTINOMIALNB(C,D)
1 V ← EXTRACTVOCABULARY(D)
2 N ← COUNTDOCS(D)
3 for each c ∈ C
4 do Nc ← COUNTDOCSINCLASS(D, c)
5 prior[c] ← Nc/N
6 textc ← CONCATENATETEXTOFALLDOCSINCLASS(D, c)
7 for each t ∈ V
8 do Tct ← COUNTTOKENSOFTERM(textc, t)
9 for each t ∈ V
10 do condprob[t][c] ← Tct+1
åt′ (Tct′+1)
11 return V, prior, condprob

C#
APPLYMULTINOMIALNB(C,V, prior, condprob, d)
1 W ← EXTRACTTOKENSFROMDOC(V, d)
2 for each c ∈ C
3 do score[c] ← log prior[c]
4 for each t ∈ W
5 do score[c] += log condprob[t][c]
6 return argmaxc∈C score[c]



i've a problem to change it into C# code.
can someone help me to solve this?
Posted
Comments
Sergey Alexandrovich Kryukov 9-Apr-14 23:53pm    
Sorry, no. This is not the case when you need some expert's advice. This is just work to be done. If you are lazy to do your work, the help won't really help you. If you don't know what to do, you need to explain what is your problem.
What have you tried so far?
—SA
Emre Ataseven 10-Apr-14 0:59am    
is it homework?

1 solution

We do not do your work for you: if you want something coded, then you will have to pay. I suggest you go to vWorker and ask there - but beware, you get what you pay for. Pay peanuts, get monkeys...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900