0

NLTK does not seem to have a cross validation method.

I was trying to develop an Hidden Markov Model (HMM) based tagger in NLTK. I found a previous post on related topic. Based on the answers here if I try to write it as,

cv = cross_validation.KFold(len(train_corp), n_folds=10,shuffle=False)
    for traincv, testcv in cv:
        hmm_tagger=nltk.HiddenMarkovModelTagger.train(train_corp[traincv[0]:traincv[len(traincv)-1]])
        evaluation=hmm_tagger.evaluate(train_corp[testcv[0]:testcv[len(testcv)-1]])
        print evaluation

am I going fine?

If any one may kindly suggest.

Community
  • 1
  • 1
Coeus2016
  • 355
  • 4
  • 14
  • Using `graphlab`, take a look at code no. [5] on https://github.com/alvations/stasis/blob/master/notebooks/SHIELD.ipynb. – alvas Apr 18 '16 at 03:29
  • For `scikit-learn`, take a look at http://scikit-learn.org/stable/modules/cross_validation.html – alvas Apr 18 '16 at 03:31

0 Answers0