private void createSorted() throws ClassifierException
{
if (logger.isDebugEnabled()){logger.debug("SorterOfTreeHistory: creating sorted map...");}
if (logger.isDebugEnabled()){logger.debug(String.format("Classifier threshold = %-4.4f", classifier.getThreshold()));}
Map<TreeHistoryComponent,Double> map = new HashMap<TreeHistoryComponent, Double>();
double initialCost = -classifier.getProduct(treeHistory.getInitialComponent().getFeatureVector());
if (logger.isDebugEnabled()){logger.debug(String.format("Initial cost = %-4.4f", initialCost));}
double prevCost = initialCost;
for (TreeHistoryComponent component : treeHistory.getComponents())
{
double currentCost = -classifier.getProduct(component.getFeatureVector());
map.put(component, currentCost-prevCost);
if (logger.isDebugEnabled()){logger.debug(String.format("Cost = %-4.4f. Delta = %-4.4f Spec = %s", currentCost, (currentCost-prevCost), component.getSpecification().toString()));}
prevCost = currentCost;
}
List<TreeHistoryComponent> sorted = Utils.getSortedByValue(map);
Collections.reverse(sorted);
sortedNonIncreasingOrder = new LinkedHashMap<TreeHistoryComponent, Double>();
for (TreeHistoryComponent component : sorted)
{
sortedNonIncreasingOrder.put(component,map.get(component));
}
}