jwijffels / RMOA

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

Using HoeffdingAdaptiveTree in RMOA #7

Open abrh opened 6 years ago

abrh commented 6 years ago

I would like to use HoeffdingAdaptiveTree. This is my current code. Do I have to add the following line for HoeffdingAdaptiveTree?

MOAoptions(model = "HoeffdingAdaptiveTree")

require(RMOA)

hdt <- HoeffdingTree(numericEstimator = "GaussianNumericAttributeClassObserver")

dat2 <- factorise(iris)
dat2stream <- datastream_dataframe(data=dat2)

## Train the HoeffdingTree on the iris dataset
mymodel2 <- trainMOA(model = hdt, 
                    formula = Sepal.Length~ ., 
                    data = dat2stream, chunksize = 10)
jwijffels commented 6 years ago

You need to use

ctrl <- MOAoptions(model = "HoeffdingAdaptiveTree", leafprediction = "MC")
ctrl

And next pass that to hdt <- HoeffdingAdaptiveTree(control = ctrl) instead of HoeffdingTree where in MOAoptions you give all arguments you want to give to the hoeffdingadaptivetree or you pass them directly as in hdt <- HoeffdingAdaptiveTree(leafprediction = "MC", noPrePrune = TRUE)