The vanilla approach

The vanilla approach is to directly apply the lesson, just like as it was demonstrated in Chapter 3, Basic Algorithms - Classification, Regression, Clustering, without any preprocessing, and not taking dataset specifics into account. To demonstrate the drawbacks of the vanilla approach, we will simply build a model with the default parameters and apply k-fold cross-validation.

First, let's define some classifiers that we want to test, as follows:

ArrayList<Classifier>models = new ArrayList<Classifier>(); 
models.add(new J48()); 
models.add(new RandomForest()); 
models.add(new NaiveBayes()); 
models.add(new AdaBoostM1()); 
models.add(new Logistic()); 

Next, we need to create an Evaluation object and perform k-fold cross-validation ...

Get Machine Learning in Java - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.