I try to use a cross validator for my data, but I get 0.0 success, which makes no sense.
My data consists of patterns with 5 continuous attributes and two possible classes: "y" and "n".
My code is:
net = pybrain.tools.shortcuts.buildNetwork(5, 8, 1) trainer = BackpropTrainer(net, ds) evaluation = ModuleValidator.classificationPerformance(trainer.module, ds) validator = CrossValidator(trainer=trainer, dataset=trainer.ds, n_folds=5, valfunc=evaluation) print(validator.validate())
When I exercise regularly
print(trainer.train())
I get a reasonable error rate, so I guess that means the dataset and network are ok, and the problem is cross-reference checking.
Any ideas?
Update:
I looked at the cross-validation code and noticed that my network was outputting continuous values, not 0/1 as required. I assume that these are probabilities for each class. When the model is used inside cross-validation methods, it does not take this into account, and this means that all answers are treated as flase, si I get 0 correct answers. How to add a layer that looks at continuous values ββand returns 0 or 1, whichever is greater? The documentation is unclear.
source share