jwijffels / RMOA

Connect R to MOA for massive online data stream mining
37 stars 19 forks source link

Error when trying to train the OzaBoost model for a second data batch #3

Closed kkoshijima closed 9 years ago

kkoshijima commented 9 years ago

Hi Jan,

I asked you a couple of question via gmail back in February, and I really appreciated your kind support. I've been having some other problems lately, and thought that it might be better to ask you here.

I am trying to use the OzaBoost model. My code looks like this.

ozaboost <- OzaBoost(baseLearner = "trees.HoeffdingTree", ensembleSize = 30)

# train the model for the first data set
dataStream1 <- datastream_dataframe(data = data1)
ozaboost <- trainMOA(model = ozaboost, formula = cv ~ ., data = dataStream1, trace = TRUE, reset = FALSE)

# train the model for the second data set
dataStream2 <- datastream_dataframe(data = data2)
ozaboost <- trainMOA(model = ozaboost, formula = cv ~ ., data = dataStream2, trace = TRUE, reset = FALSE)

However, when I execute the second trainMOA function, it gives me the following error message and it stops there.

2015-04-10 19:29:43 Running chunk 1: instances 0:1000
Error in .jcall(model$moamodel, "V", "setModelContext", .jnew("moa.core.InstancesHeader",  : 
  RcallMethod: invalid object parameter

Any ideas on what I am doing wrong here?

Best,

Kensuke Koshijima

kkoshijima commented 9 years ago

Sorry, I figured it out myself.

The object returned by trainMOA is structured differently from the way the initial ozaboost object was structured. Therefore, changing the second trainMOA code solved it for me.

ozaboost <- trainMOA(model = ozaboost$model, formula = cv ~ ., data = dataStream2, trace = TRUE, reset = FALSE)