def model(commodities_vd): create_verticapy_schema() model_class = VAR("var_model_test", p=1) model_class.drop() model_class.fit("public.commodities", ["gold", "oil"], "date") yield model_class model_class.drop()
def test_model_from_vDF(self, commodities_vd): model_class = VAR("var_model_test_vdf", p=1) model_class.drop() model_class.fit(commodities_vd, ["gold", "oil"], "date") current_cursor().execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_vdf', '\"var_model_test_vdf\"')" ) assert current_cursor().fetchone()[0] in ( "var_model_test_vdf", '"var_model_test_vdf"', ) model_class.drop()
def test_drop(self): model_test = VAR("var_model_test_drop", ) model_test.drop() model_test.fit("public.commodities", ["gold", "oil"], "date") current_cursor().execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_drop', '\"var_model_test_drop\"')" ) assert current_cursor().fetchone()[0] in ( "var_model_test_drop", '"var_model_test_drop"', ) model_test.drop() current_cursor().execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_drop', '\"var_model_test_drop\"')" ) assert current_cursor().fetchone() is None
def model(base, commodities_vd): try: create_verticapy_schema(base.cursor) except: pass model_class = VAR( "var_model_test", cursor=base.cursor, p=1, ) model_class.drop() model_class.fit( "public.commodities", ["gold", "oil"], "date", ) yield model_class model_class.drop()
def test_drop(self, base): model_test = VAR("var_model_test_drop", cursor=base.cursor) model_test.drop() model_test.fit( "public.commodities", ["gold", "oil"], "date", ) base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_drop', '\"var_model_test_drop\"')" ) assert base.cursor.fetchone()[0] in ("var_model_test_drop", '"var_model_test_drop"') model_test.drop() base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_drop', '\"var_model_test_drop\"')" ) assert base.cursor.fetchone() is None
def test_model_from_vDF(self, base, commodities_vd): model_class = VAR( "var_model_test_vdf", cursor=base.cursor, p=1, ) model_class.drop() model_class.fit( commodities_vd, [ "gold", "oil", ], "date", ) base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('var_model_test_vdf', '\"var_model_test_vdf\"')" ) assert base.cursor.fetchone()[0] in ("var_model_test_vdf", '"var_model_test_vdf"') model_class.drop()