@Test
public void testIDF() throws Exception {

    Row[] rows = new Row[] {
        Row.of(0L, "{\"numFeatures\":\"20\",\"minTF\":\"1.0\",\"featureType\":\"\\\"IDF\\\"\"}"),
        Row.of(1048576L, "{\"16\":0.4054651081081644,\"7\":0.0,\"13\":0.4054651081081644,\"14\":-0.5108256237659907,"
            + "\"15\":-0.2876820724517809}")
    };
    List<Row> model = Arrays.asList(rows);
    Params params = new Params()
        .set(DocHashCountVectorizerPredictParams.SELECTED_COL, "sentence")
        .set(DocCountVectorizerTrainParams.FEATURE_TYPE, FeatureType.IDF);
    DocHashCountVectorizerModelMapper mapper = new DocHashCountVectorizerModelMapper(modelSchema, dataSchema, params);
    mapper.loadModel(model);
    assertEquals(mapper.map(Row.of("a b c d a a ")).getField(0),
        new SparseVector(20, new int[] {7, 13, 14, 15},
            new double[] {0.0, 0.4054651081081644, -0.5108256237659907, -0.2876820724517809}));
}