kogalur / randomForestSRC

DOCUMENTATION:
https://www.randomforestsrc.org/
GNU General Public License v3.0
115 stars 18 forks source link

Error "factor level in data inconsistent" during tuning #32

Closed shadogray closed 3 years ago

shadogray commented 5 years ago

Error "factor level in data inconsistent with number of levels indicated" is thrown amidst tuning run. During the tuning process the Train/Testset split is not modified. Example is attached (failrfsrc.tgz): ~> Rscript rfsrc_bug.R

failrfsrc.tar.zip

[Tune] Started tuning learner classif.randomForestSRC for parameter set: Type len Def Constr Req Tunable Trafo ntree integer - - 100 to 500 - TRUE - mtry integer - - 5 to 50 - TRUE - nodesize integer - - 1 to 10 - TRUE - nodedepth integer - - 3 to 16 - TRUE - nsplit integer - - 1 to 50 - TRUE - bootstrap discrete - - by.root - TRUE - With control class: TuneControlMBO Imputation value: -0 [Tune-x] 1: ntree=261; mtry=10; nodesize=7; nodedepth=12; nsplit=48; bootstrap=by.root [Tune-y] 1: acc.test.mean=0.7435397; time: 0.0 min [Tune-x] 2: ntree=383; mtry=40; nodesize=2; nodedepth=8; nsplit=38; bootstrap=by.root [Tune-y] 2: acc.test.mean=0.7747563; time: 0.1 min [Tune-x] 3: ntree=196; mtry=41; nodesize=4; nodedepth=7; nsplit=17; bootstrap=by.root [Tune-y] 3: acc.test.mean=0.7657664; time: 0.1 min [Tune-x] 4: ntree=317; mtry=34; nodesize=9; nodedepth=12; nsplit=31; bootstrap=by.root [Tune-y] 4: acc.test.mean=0.7219982; time: 0.1 min [Tune-x] 5: ntree=452; mtry=18; nodesize=5; nodedepth=9; nsplit=34; bootstrap=by.root [Tune-y] 5: acc.test.mean=0.7483707; time: 0.1 min [Tune-x] 6: ntree=283; mtry=27; nodesize=2; nodedepth=10; nsplit=14; bootstrap=by.root [Tune-y] 6: acc.test.mean=0.7703074; time: 0.1 min [Tune-x] 7: ntree=438; mtry=14; nodesize=7; nodedepth=12; nsplit=23; bootstrap=by.root [Tune-y] 7: acc.test.mean=0.7438340; time: 0.1 min [Tune-x] 8: ntree=326; mtry=39; nodesize=2; nodedepth=14; nsplit=33; bootstrap=by.root [Tune-y] 8: acc.test.mean=0.7702152; time: 0.1 min [Tune-x] 9: ntree=237; mtry=17; nodesize=5; nodedepth=16; nsplit=2; bootstrap=by.root Fehler in sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) : Schreibfehler, schließe pipe zum Elternprozess Ruft auf: train ... extract.factor -> mclapply -> lapply -> FUN -> sendMaster

RF-SRC: ERROR RF-SRC: Y-var factor level in data inconsistent with number of levels indicated: 1 0 Fehler in generic.predict.rfsrc(object, newdata, ensemble = ensemble, m.target = m.target, : An error has occurred in prediction. Please turn trace on for further analysis. Ruft auf: train ... predictLearner.classif.randomForestSRC -> predict -> predict.rfsrc -> generic.predict.rfsrc Ausführung angehalten

ishwaran commented 3 years ago

We tried to reproduce your error and it looks to us that this is an issue with tibble and your data not being compatible with R functions that require data frames for input.