def test_get_plot(self, winequality_vd):
     current_cursor().execute("DROP MODEL IF EXISTS model_test_plot")
     model_test = RandomForestRegressor("model_test_plot", )
     model_test.fit(winequality_vd, ["alcohol"], "quality")
     result = model_test.plot()
     assert len(result.get_default_bbox_extra_artists()) == 9
     plt.close("all")
     model_test.drop()
    def test_model_from_vDF(self, base, rfr_data_vd):
        base.cursor.execute("DROP MODEL IF EXISTS rfr_from_vDF")
        model_test = RandomForestRegressor("rfr_from_vDF", cursor=base.cursor)
        model_test.fit(rfr_data_vd, ["gender"], "transportation")

        base.cursor.execute(
            "SELECT model_name FROM models WHERE model_name = 'rfr_from_vDF'")
        assert base.cursor.fetchone()[0] == "rfr_from_vDF"

        model_test.drop()
 def test_contour(self, titanic_vd):
     model_test = RandomForestRegressor("model_contour", )
     model_test.drop()
     model_test.fit(
         titanic_vd,
         ["age", "fare"],
         "survived",
     )
     result = model_test.contour()
     assert len(result.get_default_bbox_extra_artists()) == 38
     model_test.drop()
Exemplo n.º 4
0
    def test_set_cursor(self, base):
        model_test = RandomForestRegressor("rfr_cursor_test", cursor=base.cursor)
        # TODO: creat a new cursor
        model_test.set_cursor(base.cursor)
        model_test.drop()
        model_test.fit("public.rfr_data", ["gender"], "transportation")

        base.cursor.execute(
            "SELECT model_name FROM models WHERE model_name = 'rfr_cursor_test'"
        )
        assert base.cursor.fetchone()[0] == "rfr_cursor_test"

        model_test.drop()
    def test_drop(self):
        current_cursor().execute("DROP MODEL IF EXISTS rfr_model_test_drop")
        model_test = RandomForestRegressor("rfr_model_test_drop", )
        model_test.fit(
            "public.rfr_data",
            ["Gender", '"owned cars"', "cost", "income"],
            "TransPortation",
        )

        current_cursor().execute(
            "SELECT model_name FROM models WHERE model_name = 'rfr_model_test_drop'"
        )
        assert current_cursor().fetchone()[0] == "rfr_model_test_drop"

        model_test.drop()
        current_cursor().execute(
            "SELECT model_name FROM models WHERE model_name = 'rfr_model_test_drop'"
        )
        assert current_cursor().fetchone() is None