public class PredictiveAccuracyTests {
private static final Logger logger = LoggerFactory.getLogger(PredictiveAccuracyTests.class);
@Test
public void irisTest() throws Exception {
StationaryCrossValidator stationaryCrossValidator = new StationaryCrossValidator(new ClassifierRMSECrossValLossFunction());
final List<Instance<AttributesMap>> irisDataset = Benchmarks.loadIrisDataset();
final double crossValidatedLoss = stationaryCrossValidator.getCrossValidatedLoss(new RandomForestBuilder(), irisDataset);
double previousLoss = 0.673;
logger.info("Cross Validated Lost: {}", crossValidatedLoss);
Assert.assertTrue(crossValidatedLoss <= previousLoss, String.format("Current loss is %s, but previous loss was %s, this is a regression", crossValidatedLoss, previousLoss));
Assert.assertTrue(crossValidatedLoss > previousLoss * 0.95, String.format("Current loss is %s, but previous loss was %s, this is a significant improvement, previousLoss should be updated", crossValidatedLoss, previousLoss));