How to find likelihood in NLTK -


http://www.laurentluce.com/posts/twitter-sentiment-analysis-using-python-and-nltk/comment-page-1/#comment-73511

i trying understand nltk using link. cannot understand how values of feature_probdist , show_most_informative_features computed.

esp when word "best" not come how likelihood computed 0.077 . trying since long

that because explaining code nltk's source code not displaying of it. full code available on nltk's website (and linked in article referenced). these field within method , method (respectively) of the naivebayesclassifier class within nltk. class of course using naive bayes classifier, modification of bayes theorum strong (naive) assumption each event independent.

  • feature_probdist = "p(fname=fval|label), probability distribution feature values, given labels. expressed dictionary keys (label,fname) pairs , values probdistis on feature values. i.e., p(fname=fval|label) = feature_probdist[label,fname].prob(fval). if given (label,fname) not key in feature_probdist, assumed corresponding p(fname=fval|label) 0 values of fval."

  • most_informative features returns "a list of 'most informative' features used classifier. purpose of function, informativeness of feature (fname,fval) equal highest value of p(fname=fval|label), label, divided lowest value of p(fname=fval|label), label:"

    max[ p(fname=fval|label1) / p(fname=fval|label2) ] 

check out the source code entire class if still unclear, article's intent not break down how nltk works under hood in depth, rather give basic concept of how use it.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -