List<EvaluationFunction> evalFuncs1 = new ArrayList<EvaluationFunction>();
evalFuncs1.add(new Task1ScoreForBins(bins));
List<EvaluationFunction> evalFuncs2 = new ArrayList<EvaluationFunction>();
evalFuncs2.add(new Task1Score());
evalFuncs2.add(new MeanSquaredError());
evalFuncs2.add(new MeanAbsoluteError());
LibLINEARParameters linParms = new LibLINEARParameters(LibLINEARParameters.SVC_DUAL, cs);
linParms.setEvalFunction(new Task1ScoreForBothBins(bins));
linParms.setDoCrossValidation(false);
linParms.setSplitFraction((float) 0.8);
linParms.setEps(0.1);
linParms.setPs(ps1);
Map<Double, Double> counts = EvaluationUtils.computeClassCounts(targetBins);
int[] wLabels = new int[counts.size()];
double[] weights = new double[counts.size()];
for (double label : counts.keySet()) {
wLabels[(int) label - 1] = (int) label;
weights[(int) label - 1] = 1 / counts.get(label);
}
linParms.setWeightLabels(wLabels);
linParms.setWeights(weights);
LibLINEARParameters linParms2 = new LibLINEARParameters(LibLINEARParameters.SVR_DUAL, cs);
linParms2.setEvalFunction(new Task1Score());
linParms2.setDoCrossValidation(false);
linParms2.setSplitFraction((float) 0.8);
linParms2.setEps(0.1);
linParms2.setPs(ps2);
linParms2.setBias(1);