machine learning - rare error when running my function in R -
i have 2 function. 1 train classifier , 1 predict test data. if run predict function step step works fine, if call predict function error. can't know happening due code of function has no errors compiled manually. i've upload 2 functions , data on github.you can access here
modelfit=mdp(class = dades[,1],data=dades[,-1],lambda = 1,info.pred = t) predict.mdp(modelfit, dades[1:5,-1]) error in d[row, i] : subscript out of bounds thank can help
the reason see in d[row, i] , variable row overshooting number of rows in d. row derived vec.new : for(row in vec.new)
this piece culprit :
start=dim(d)[1] vec.new=(start+1):(start+dim(newdata)[1]) vec.new starts nrow(d)+1 , first element beyond size of d .
you can insert cat(row) in code , see.
i guess have think start should be.
Comments
Post a Comment