diff --git a/JSAT/src/jsat/classifiers/svm/extended/CPM.java b/JSAT/src/jsat/classifiers/svm/extended/CPM.java index 11db4753..e849d721 100644 --- a/JSAT/src/jsat/classifiers/svm/extended/CPM.java +++ b/JSAT/src/jsat/classifiers/svm/extended/CPM.java @@ -23,6 +23,7 @@ import java.util.concurrent.ExecutorService; import jsat.DataSet; import jsat.classifiers.*; +import jsat.classifiers.calibration.BinaryScoreClassifier; import jsat.distributions.Distribution; import jsat.distributions.LogUniform; import jsat.distributions.Uniform; @@ -43,6 +44,11 @@ * hyper-planes to create a non-linear classifier. Increasing the number of * hyper-planes increases training/prediction time, but also increases the * amount of non-linearity the model can tolerate.
+ *
+ * While the CPM implements the {@link BinaryScoreClassifier} interface, the CPM + * decision algorithm does not completely lend itself to producing a natural + * score in this manner. For this reason you may observe unusual behavior from + * the CPM if you rely on this interface, compared with other approaches. * * *
See: Kantchelian, A., Tschantz, M. C., Huang, L., Bartlett, P. L., @@ -52,7 +58,7 @@ * from here * @author Edward Raff */ -public class CPM implements Classifier, Parameterized +public class CPM implements BinaryScoreClassifier, Classifier, Parameterized { private static final long serialVersionUID = 3171068484917637037L; @@ -286,6 +292,17 @@ else if(neg_score > pos_score )//not actually how describes in paper, but its am return cr; } + @Override + public double getScore(DataPoint dp) + { + Vec x = dp.getNumericalValues(); + + double pos_score = Wp.multiply(x).add(bp).max(); + double neg_score = Wn.multiply(x).add(bn).max(); + + return pos_score-neg_score; + } + @Override public boolean supportsWeightedData() {