示例#1
0
 def test_model_from_vDF(self, titanic_vd):
     model_test = DBSCAN("dbscan_from_vDF")
     model_test.drop()
     model_test.fit(titanic_vd, ["age", "fare"], "survived")
     assert model_test.predict()["dbscan_cluster"].min() == pytest.approx(
         -1, abs=1e-6)
     model_test.drop()
示例#2
0
def model(titanic_vd):
    create_verticapy_schema()
    model_class = DBSCAN("DBSCAN_model_test", )
    model_class.drop()
    model_class.fit("public.titanic", ["age", "fare"])
    yield model_class
    model_class.drop()
示例#3
0
def model(base, titanic_vd):
    try:
        create_verticapy_schema(base.cursor)
    except:
        pass
    model_class = DBSCAN("DBSCAN_model_test", cursor=base.cursor)
    model_class.drop()
    model_class.fit(
        "public.titanic",
        [
            "age",
            "fare",
        ],
    )
    yield model_class
    model_class.drop()
示例#4
0
    def test_drop(self):
        model_test = DBSCAN("model_test_drop", )
        model_test.drop()
        model_test.fit("public.titanic", ["age", "fare"], "survived")
        current_cursor().execute(
            "SELECT model_name FROM verticapy.models WHERE model_name IN ('model_test_drop', '\"model_test_drop\"')"
        )
        assert current_cursor().fetchone()[0] in (
            "model_test_drop",
            '"model_test_drop"',
        )

        model_test.drop()
        current_cursor().execute(
            "SELECT model_name FROM verticapy.models WHERE model_name IN ('model_test_drop', '\"model_test_drop\"')"
        )
        assert current_cursor().fetchone() is None
示例#5
0
    def test_drop(self, base):
        model_test = DBSCAN("model_test_drop", cursor=base.cursor)
        model_test.drop()
        model_test.fit("public.titanic", [
            "age",
            "fare",
        ], "survived")
        base.cursor.execute(
            "SELECT model_name FROM verticapy.models WHERE model_name IN ('model_test_drop', '\"model_test_drop\"')"
        )
        assert base.cursor.fetchone()[0] in ('model_test_drop',
                                             '"model_test_drop"')

        model_test.drop()
        base.cursor.execute(
            "SELECT model_name FROM verticapy.models WHERE model_name IN ('model_test_drop', '\"model_test_drop\"')"
        )
        assert base.cursor.fetchone() is None