@Test
public void testImpurityLeftAndRightPart() {

    // Test on left part [1, 2, 2] and right part [1, 1, 1].
    MSEImpurityMeasure impurity = new MSEImpurityMeasure(5, 9, 3, 3, 3, 3);
    assertEquals(0.666, impurity.impurity(), 1e-3);
}