@Override
    public List<Double> transform(List<Double> in) {
        if (in.size() != values.size()) {
            throw new MLException(String.format(
                    "Unexpected in-vector size. Expected: %d, Got: %d", values.size(), in.size()));
        }
        List<Double> out = new ArrayList<Double>();
        for (int i = 0; i < in.size(); i++) {
            if (values.get(i) == 1) {
                out.add(in.get(i));
            } else {
                int outStart = out.size() - 1;
                for (int j = 0; j < values.get(i); j++) {
                    out.add(0.0);
                }
                if (in.get(i) != Matrix.UNKNOWN_VALUE) {
                    if (in.get(i) >= values.get(i)) {
                        throw new MLException(
                                String.format("Value out of range. Expected: [0-%d]. Got: %d",
                                        values.get(i) - 1, in.get(i)));
                    }
                    out.set(outStart + in.get(i).intValue(), 1.0);
                }
            }
        }
        return out;
    }