public static Integer getDominantClass(Dataset instances) {
        HashMap<Integer, Integer> classMap = getClassmap(instances);
        Integer maxClassKey = null;
        for (Integer key: classMap.keySet()) {
            if (maxClassKey != null) {
                if (classMap.get(key) > classMap.get(maxClassKey)) {
                    maxClassKey = key;
                }
            } else {
                maxClassKey = key;
            }
        }

        return maxClassKey;
    }