private static void getData(Matrix matrix, String line) {
        String[] cols = line.toLowerCase().split(",");
        if (matrix.getNumCols() != cols.length) {
            throw new MLException(String.format(
                    "Number of columns mismatch. Expected: %d, Got: %d", matrix.getNumCols(), cols.length));
        }

        List<Double> row = new ArrayList<Double>();
        for (int i = 0; i < cols.length; i++) {
            String val = cols[i].trim();
            if (val.equals("?")) {
                row.add(Matrix.UNKNOWN_VALUE);
            } else if (matrix.isContinuous(i)) {
                row.add(Double.valueOf(val));
            } else {
                ColumnAttributes column = matrix.getColumnAttributes(i);
                int valueIndex = column.getIndex(val);

                if (valueIndex < 0) {
                    throw new MLException("Value index not found: " + cols[i]);
                }

                row.add((double) valueIndex);
            }
        }
        matrix.addRow(row);
    }