double CB = m_costBenefit.
getPlotInstances().instance(index).value(1);
m_costBenefitV.setText(Utils.doubleToString(CB,2));
double totalRandomCB = 0.0;
Instance first = m_masterPlot.getPlotInstances().instance(0);
double totalPos = first.value(m_masterPlot.getPlotInstances().
attribute(ThresholdCurve.TRUE_POS_NAME).index()) * scaleFactor;
double totalNeg = first.value(m_masterPlot.getPlotInstances().
attribute(ThresholdCurve.FALSE_POS_NAME)) * scaleFactor;
double posInSample = (totalPos * (Double.parseDouble(m_percPopLab.getText()) / 100.0));
double negInSample = (totalNeg * (Double.parseDouble(m_percPopLab.getText()) / 100.0));
double posOutSample = totalPos - posInSample;
double negOutSample = totalNeg - negInSample;
double tpCost = 0.0;
try {
tpCost = Double.parseDouble(m_cost_aa.getText());
} catch (NumberFormatException n) {}
double fpCost = 0.0;
try {
fpCost = Double.parseDouble(m_cost_ba.getText());
} catch (NumberFormatException n) {}
double tnCost = 0.0;
try {
tnCost = Double.parseDouble(m_cost_bb.getText());
} catch (NumberFormatException n) {}
double fnCost = 0.0;
try {
fnCost = Double.parseDouble(m_cost_ab.getText());
} catch (NumberFormatException n) {}
totalRandomCB += posInSample * tpCost;
totalRandomCB += negInSample * fpCost;
totalRandomCB += posOutSample * fnCost;
totalRandomCB += negOutSample * tnCost;
m_randomV.setText(Utils.doubleToString(totalRandomCB, 2));
double gain = (m_costR.isSelected())
? totalRandomCB - CB
: CB - totalRandomCB;
m_gainV.setText(Utils.doubleToString(gain, 2));
// update classification rate
Instance currentInst = m_masterPlot.getPlotInstances().instance(index);
double tp = currentInst.value(m_masterPlot.getPlotInstances().
attribute(ThresholdCurve.TRUE_POS_NAME).index());
double tn = currentInst.value(m_masterPlot.getPlotInstances().
attribute(ThresholdCurve.TRUE_NEG_NAME).index());
m_classificationAccV.
setText(Utils.doubleToString((tp + tn) / (totalPos + totalNeg) * 100.0, 4) + "%");
}