throw new IllegalArgumentException("Predicted vector cannot be categorical for regression scoring.");
}
public void execImpl() {
init();
Vec va = null,vp = null, avp = null;
try {
if (classification) {
// Create a new vectors - it is cheap since vector are only adaptation vectors
va = vactual .toEnum(); // always returns TransfVec
actual_domain = va.factors();
vp = vpredict.toEnum(); // always returns TransfVec
predicted_domain = vp.factors();
if (!Arrays.equals(actual_domain, predicted_domain)) {
domain = ArrayUtils.domainUnion(actual_domain, predicted_domain);
int[][] vamap = Model.getDomainMapping(domain, actual_domain, true);
va = TransfVec.compose( (TransfVec) va, vamap, domain, false ); // delete original va
int[][] vpmap = Model.getDomainMapping(domain, predicted_domain, true);
vp = TransfVec.compose( (TransfVec) vp, vpmap, domain, false ); // delete original vp
} else domain = actual_domain;
// The vectors are from different groups => align them, but properly delete it after computation
if (!va.group().equals(vp.group())) {
avp = vp;
vp = va.align(vp);
}
cm = new CM(domain.length).doAll(va,vp)._cm;
} else {
mse = new CM(1).doAll(vactual,vpredict).mse();
}