Thanks. Its working now. My test data had some labels which were not there in training set.
On Wednesday, June 28, 2017, Pralabh Kumar <pralabhku...@gmail.com <javascript:_e(%7B%7D,'cvml','pralabhku...@gmail.com');>> wrote: > Hi Neha > > This generally occurred when , you training data set have some value of > categorical variable ,which in not there in your testing data. For e.g you > have column DAYS ,with value M,T,W in training data . But when your test > data contains F ,then it say no key found exception . Please look into > this , and if that's not the case ,then Could you please share your code > ,and training/testing data for better understanding. > > Regards > Pralabh Kumar > > On Wed, Jun 28, 2017 at 11:45 AM, neha nihal <nehaniha...@gmail.com> > wrote: > >> >> Hi, >> >> I am using Apache spark 2.0.2 randomforest ml (standalone mode) for text >> classification. TF-IDF feature extractor is also used. The training part >> runs without any issues and returns 100% accuracy. But when I am trying to >> do prediction using trained model and compute test error, it fails with >> java.util.NosuchElementException: key not found exception. >> Any help will be much appreciated. >> >> Thanks >> >> >