In this example, we demonstrated usage of the One-vs-Rest classifier. We began by loading the classic Iris dataset in libsvm format. Next, we split the dataset with a ratio of 80% for a training dataset and 20% for a test dataset. We draw the users' attention to how we use system time for randomness in a split as follows:
data.randomSplit(Array( 0.8 , 0.2 ), seed = System.currentTimeMillis())
The algorithm can be best described as a three-step process:
- We first configure the regression object without having to have a base logistic model at hand so it can be fed into our classifier:
LogisticRegression().setMaxIter(15).setTol(1E-3).setFitIntercept(true)
-
In the next step, we feed the configured regression model into our classifier ...