/** * Score. * * @param sig the sig * @return the double * @throws ClassifierException the classifier exception */ public double score(DefaultVectorSignature sig) throws ClassifierException { if (hasDataProcessor()) { try { return scoreImpl(dataProcessor.apply(sig)); } catch (SignatureException e) { throw new ClassifierException(e); } } else { return scoreImpl(sig); } }
/** * Data process. * * @param positive the positive * @param negative the negative * @return the vector signature[][] * @throws ClassifierException the classifier exception */ protected DefaultVectorSignature[][] dataProcess( DefaultVectorSignature[] positive, DefaultVectorSignature[] negative) throws ClassifierException { log("Launching DataProcessor for learn data"); DefaultVectorSignature[][] data = new DefaultVectorSignature[2][]; try { dataProcessor.estimateParameters(positive, negative); data[0] = dataProcessor.apply(positive); data[1] = dataProcessor.apply(negative); learnDataProcessed = true; } catch (SignatureException e) { throw new ClassifierException(e); } return data; }