def test_on_boston(): return X, y = load_boston() model = FactorizationMachineRegressor(k=2) model.fit(X[:400], y[:400]) y_pred = model.predict(X[400:]) assert mae(y[400:], y_pred) == pytest.approx(3.9, 0.1)
def test_on_boston(): X, y = load_boston() scale = make_scaler(X[:400]) model = LinearRegressor() model.fit(scale(X[:400]), y[:400]) y_pred = model.predict(scale(X[400:])) assert mae(y[400:], y_pred) == pytest.approx(5, 0.1)
def test_on_boston(): X, y = load_boston() model = DecisionTreeRegressor() model.fit(X[:400], y[:400]) y_pred = model.predict(X[400:]) assert mae(y[400:], y_pred) == pytest.approx(4.0, 0.1)
def test_on_boston(): X, y = load_boston() model = ExtraTreesRegressor() model.fit(X[:400], y[:400]) y_pred = model.predict(X[400:]) assert mae(y[400:], y_pred) == pytest.approx(3.9, 0.1)
def test_on_boston(): X, y = load_boston() model = RandomForestRegressor() model.fit(X[:400], y[:400]) y_pred = model.predict(X[400:]) assert mae(y[400:], y_pred) == pytest.approx(3.2, 0.1)
def test_on_boston(): X, y = load_boston() model = GradientBoostingRegressor() model.fit(X[:400], y[:400]) y_pred = model.predict(X[400:]) assert mae(y[400:], y_pred) == pytest.approx(4.3, 0.1)