When attempting to do a K-fold cross validation of the Random Forest model, I get the following:
java.lang.IllegalArgumentException: Invalid posteriori vector size: 4, expected: 5
at smile.classification.RandomForest.predict(RandomForest.java:602)
at smile.classification.RandomForest.predict(RandomForest.java:78)
at smile.validation.ClassificationValidation.of(ClassificationValidation.java:177)
at smile.validation.ClassificationValidation.of(ClassificationValidation.java:206)
at smile.validation.CrossValidation.classification(CrossValidation.java:293)
at com.gmg.p7.app.text_alignment.TextAlignmentTrainer.train(TextAlignmentTrainer.java:374)
at com.gmg.p7.app.text_alignment.TextAlignmentTrainer.main(TextAlignmentTrainer.java:464)
Problem seems to be in ClassificationValidation.java line 166:
int k = MathEx.unique(y).length;
The code extracts the number of labels by looking at the data instead of the measure definition.
When attempting to do a K-fold cross validation of the Random Forest model, I get the following:
Problem seems to be in ClassificationValidation.java line 166:
The code extracts the number of labels by looking at the data instead of the measure definition.
Replacing the above with:
solves the problem.
I see the same statement in line 106 as well.
Please fix - thank you!