def model(base, amazon_vd): try: create_verticapy_schema(base.cursor) except: pass model_class = SARIMAX("sarimax_model_test", cursor=base.cursor, p=1, d=1, q=1, s=12, P=1, D=1, Q=1, max_pik=20) model_class.drop() model_class.fit("public.amazon", "number", "date",) yield model_class model_class.drop()
def test_model_from_vDF(self, base, amazon_vd): model_class = SARIMAX("sarimax_model_test_vdf", cursor=base.cursor, p=1, d=1, q=1, s=12, P=1, D=1, Q=1, max_pik=20) model_class.drop() model_class.fit(amazon_vd, "number", "date",) base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('sarimax_model_test_vdf', '\"sarimax_model_test_vdf\"')" ) assert base.cursor.fetchone()[0] in ("sarimax_model_test_vdf", '"sarimax_model_test_vdf"') model_class.drop()
def test_drop(self, base): model_test = SARIMAX("sarimax_model_test_drop", cursor=base.cursor) model_test.drop() model_test.fit("public.amazon", "number", "date",) base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('sarimax_model_test_drop', '\"sarimax_model_test_drop\"')" ) assert base.cursor.fetchone()[0] in ("sarimax_model_test_drop", '"sarimax_model_test_drop"') model_test.drop() base.cursor.execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('sarimax_model_test_drop', '\"sarimax_model_test_drop\"')" ) assert base.cursor.fetchone() is None
def model(amazon_vd): create_verticapy_schema() model_class = SARIMAX("sarimax_model_test", p=1, d=1, q=1, s=12, P=1, D=1, Q=1, max_pik=20) model_class.drop() model_class.fit("public.amazon", "number", "date") yield model_class model_class.drop()
def test_drop(self): model_test = SARIMAX("sarimax_model_test_drop", ) model_test.drop() model_test.fit("public.amazon", "number", "date") current_cursor().execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('sarimax_model_test_drop', '\"sarimax_model_test_drop\"')" ) assert current_cursor().fetchone()[0] in ( "sarimax_model_test_drop", '"sarimax_model_test_drop"', ) model_test.drop() current_cursor().execute( "SELECT model_name FROM verticapy.models WHERE model_name IN ('sarimax_model_test_drop', '\"sarimax_model_test_drop\"')" ) assert current_cursor().fetchone() is None
def test_repr(self, model): assert "Additional Info" in model.__repr__() model_repr = SARIMAX("sarimax_repr", cursor=model.cursor) model_repr.drop() assert model_repr.__repr__() == "<SARIMAX>"