Instance instance = new Instance(data.get(ii).getData(),lv,null,null);
dataLabeled.add(instance);
}
// train supervised
MaxEntOptimizableByLabelDistribution opt = new MaxEntOptimizableByLabelDistribution(dataLabeled,p);
opt.setGaussianPriorVariance(pGPV);
LimitedMemoryBFGS bfgs = new LimitedMemoryBFGS(opt);
try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
bfgs.reset();
try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
double value = 0;
for (MaxEntPRConstraint constraint : q.getConstraintFeatures()) {
// plus sign because this returns negative values
value += constraint.getCompleteValueContribution();
}
value += entropy + opt.getValue();
return value;
}