public CategoricalResults classify(DataPoint data) { if (coefficents == null) throw new UntrainedModelException("Model has not yet been trained"); else if (shift != 0 || scale != 1) throw new UntrainedModelException("Model was trained for regression, not classifiaction"); CategoricalResults results = new CategoricalResults(2); // It looks a little backwards. But if the true class is 0, and we are accurate, then we expect // regress to return a value near zero. results.setProb(1, regress(data)); results.setProb(0, 1.0 - results.getProb(1)); return results; }