jwijffels / RMOA

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

How can I get the RMOA model as object #9

Open abrh opened 6 years ago

abrh commented 6 years ago

Following by is the model I have. I would like to extract just the model (i.e. Model description) and use it. I tried to get it in the following ways with no success:

myNewModel$model.MOA_model NULL myNewModel$model$MOA_model NULL myNewModel$MOA_model NULL.

My target is to extract the model itself and use it with as.party for instance. (I get > as.party (myNewModel$model) Error in UseMethod("as.party") : no applicable method for 'as.party' applied to an object of class "c('HoeffdingAdaptiveTree', 'MOA_classifier', 'MOA_model')" )

Here is the model:

myNewModel$model HoeffdingAdaptiveTree modelling options: MOA model name: Hoeffding Adaptive Tree for evolving data streams that uses ADWIN to replace branches for new ones.

  • maxByteSize: 33554432 (Maximum memory consumed by the tree.)
  • numericEstimator: GaussianNumericAttributeClassObserver (Numeric estimator to use.)
  • nominalEstimator: NominalAttributeClassObserver (Nominal estimator to use.)
  • memoryEstimatePeriod: 1000000 (How many instances between memory consumption checks.)
  • gracePeriod: 200 (The number of instances a leaf should observe between split attempts.)
  • splitCriterion: InfoGainSplitCriterion (Split criterion to use.)
  • splitConfidence: 1e-07 (The allowable error in split decision, values closer to 0 will take longer to decide.)
  • tieThreshold: 0.05 (Threshold below which a split will be forced to break ties.)
  • binarySplits: false (Only allow binary splits.)
  • stopMemManagement: false (Stop growing as soon as memory limit is hit.)
  • removePoorAtts: false (Disable poor attributes.)
  • noPrePrune: false (Disable pre-pruning.)
  • leafprediction: MC (Leaf prediction to use.)
  • nbThreshold: 0 (The number of instances a leaf should observe before permitting Naive Bayes.) Model type: moa.classifiers.trees.HoeffdingAdaptiveTree model training instances = 1,007,000 model serialized size (bytes) = -482.0 tree size (nodes) = 107 tree size (leaves) = 54 active learning leaves = 54 tree depth = 8 active leaf byte size estimate = 0.0 inactive leaf byte size estimate = 0.0 byte size estimate overhead = 1 Model description: if [att 5:E] <= 2.909090909090909: if [att 3:C] <= 2.090909090909091: if [att 1:A] <= 2.090909090909091: if [att 9:I] <= 2.090909090909091: if [att 7:G] <= 2.090909090909091: Leaf [class:CLA] = <class 1:0> weights: {15,044.439|9,086.526|632.399|0|108|1,044|0|0}
jwijffels commented 6 years ago

There is no as.party for these objects. If you want to get more information from the model, you need to get the java object elements. Just use the $ operator on the java object which is returned by the model and see which methods are available and try to obtain what you want by looking at the docs (https://jwijffels.github.io/RMOA, https://jwijffels.github.io/RMOA/MOA_2014_11/doc/apidocs/index.html)