kogalur / randomForestSRC

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

Prediction result, error NaN #271

Open yrsong001 opened 2 years ago

yrsong001 commented 2 years ago

I have trained a brf model for my data. when predict on the test Data, the result is wired as below. I split the data by createDataPartition() function. The performance for traindata also attatched. ModelData.brf.train <- imbalanced(f, as.data.frame(traindata), method = "brf", perf.type = "gmean", importance = TRUE)

print(ModelData.brf.test) Sample size of test (predict) data: 18486 Number of grow trees: 3000 Average no. of grow terminal nodes: 2170.7517 Total no. of grow variables: 16 Resampling used to grow trees: swr Resample size used to grow trees: 10566 Analysis: RF-C Family: class Imbalanced ratio: NaN Brier score: 0.00144964 Normalized Brier score: 0.00579856 AUC: NaN PR-AUC: NA G-mean: NaN Requested performance error: 0

Confusion matrix:

      predicted

observed 0 1 class.error 0 0 0 NaN 1 0 0 NaN

       Misclassification error: NaN

print(ModelData.brf.train) Sample size: 69131 Frequency of class labels: 63848, 5283 Number of trees: 3000 Forest terminal node size: 1 Average no. of terminal nodes: 2170.7517 No. of variables tried at each split: 4 Total no. of variables: 16 Resampling used to grow trees: swr Resample size used to grow trees: 10566 Analysis: RF-C Family: class Splitting rule: gini Imbalanced ratio: 12.0856 (OOB) Brier score: 0.14548369 (OOB) Normalized Brier score: 0.58193477 (OOB) AUC: 0.81455718 (OOB) PR-AUC: 0.41409956 (OOB) G-mean: 0.73654094 (OOB) Requested performance error: 0.26345906

Confusion matrix:

      predicted

observed 0 1 class.error 0 50647 13201 0.2068 1 1670 3613 0.3161

  (OOB) Misclassification rate: 0.2151133
ishwaran commented 2 years ago

Please provide a reproducible example in R. We need a worked out example in order to investigate.