Пример #1
0
def model(base, winequality_vd):
    base.cursor.execute("DROP MODEL IF EXISTS ridge_model_test")
    model_class = Ridge("ridge_model_test", cursor=base.cursor)
    model_class.fit("public.winequality",
                    ["citric_acid", "residual_sugar", "alcohol"], "quality")
    yield model_class
    model_class.drop()
Пример #2
0
 def test_get_plot(self, base, winequality_vd):
     base.cursor.execute("DROP MODEL IF EXISTS model_test_plot")
     model_test = Ridge("model_test_plot", cursor=base.cursor)
     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()
Пример #3
0
    def test_model_from_vDF(self, base, winequality_vd):
        base.cursor.execute("DROP MODEL IF EXISTS ridge_from_vDF")
        model_test = Ridge("ridge_from_vDF", cursor=base.cursor)
        model_test.fit(winequality_vd, ["alcohol"], "quality")

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

        model_test.drop()
Пример #4
0
 def test_contour(self, winequality_vd):
     model_test = Ridge("model_contour", )
     model_test.drop()
     model_test.fit(
         winequality_vd,
         ["citric_acid", "residual_sugar"],
         "quality",
     )
     result = model_test.contour()
     assert len(result.get_default_bbox_extra_artists()) == 30
     model_test.drop()
Пример #5
0
    def test_model_from_vDF(self, winequality_vd):
        current_cursor().execute("DROP MODEL IF EXISTS ridge_from_vDF")
        model_test = Ridge("ridge_from_vDF", )
        model_test.fit(winequality_vd, ["alcohol"], "quality")

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

        model_test.drop()
Пример #6
0
    def test_set_cursor(self, base):
        model_test = Ridge("ridge_cursor_test", cursor=base.cursor)
        # TODO: creat a new cursor
        model_test.set_cursor(base.cursor)
        model_test.drop()
        model_test.fit("public.winequality", ["alcohol"], "quality")

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

        model_test.drop()
Пример #7
0
    def test_drop(self, base):
        base.cursor.execute("DROP MODEL IF EXISTS ridge_model_test_drop")
        model_test = Ridge("ridge_model_test_drop", cursor=base.cursor)
        model_test.fit("public.winequality", ["alcohol"], "quality")

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

        model_test.drop()
        base.cursor.execute(
            "SELECT model_name FROM models WHERE model_name = 'ridge_model_test_drop'"
        )
        assert base.cursor.fetchone() is None
Пример #8
0
    def test_drop(self):
        current_cursor().execute("DROP MODEL IF EXISTS ridge_model_test_drop")
        model_test = Ridge("ridge_model_test_drop", )
        model_test.fit("public.winequality", ["alcohol"], "quality")

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

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