@Override
    public String toString() {
        String r = response == null ? "" : response.toString();
        String p = Arrays.stream(predictors).map(predictor -> {
            String s = predictor.toString();
            if (!s.startsWith("- ")) s = "+ " + s;
            return s;
        }).collect(Collectors.joining(" "));

        if (p.startsWith("+ ")) p = p.substring(2);
        return String.format("%s ~ %s", r, p);
    }
@Test
    public void testToString() {
        System.out.println("toString");
        Formula formula = Formula.lhs("salary");
        assertEquals("salary ~ .", formula.toString());
        assertEquals(formula, Formula.of(formula.toString()));

        formula = Formula.rhs($("salary"));
        assertEquals(" ~ salary", formula.toString());
        assertEquals(formula, Formula.of(formula.toString()));

        formula = Formula.of("salary", dot(), cross("a", "b", "c") , delete("d"));
        assertEquals("salary ~ . + (a x b x c) - d", formula.toString());
        assertEquals(formula, Formula.of(formula.toString()));
    }