def test_submit_xgb_train_task(self): model_params = { "booster": "gbtree", "eta": 0.4, "num_class": 3, "objective": "multi:softprob" } train_params = {"num_boost_round": 10} feature_columns_code = """ xgboost_extended.feature_column.numeric_column( "sepal_length", shape=[1]), xgboost_extended.feature_column.numeric_column( "sepal_width", shape=[1]), xgboost_extended.feature_column.numeric_column( "petal_length", shape=[1]), xgboost_extended.feature_column.numeric_column( "petal_width", shape=[1]) """ train(testing.get_datasource(), "XGBoost", "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "select * from alifin_jtest_dev.sqlflow_iris_train", model_params, "e2etest_xgb_classify_model", None, train_params=train_params, feature_columns=eval("[%s]" % feature_columns_code), feature_metas=iris_feature_metas, label_meta=iris_label_meta, feature_column_names=iris_feature_column_names, feature_columns_code=feature_columns_code)
def test_submit_pai_random_forest_train_task(self): train(testing.get_datasource(), "RandomForests", "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", { "tree_num": 3, }, "e2e_test_random_forest", "", feature_column_names=iris_feature_column_names, label_meta=iris_label_meta)
def test_submit_pai_kmeans_train_task(self): train( testing.get_datasource(), "KMeans", "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", { "excluded_columns": "class", "idx_table_name": "alifin_jtest_dev.e2e_test_kmeans_output_idx" }, "e2e_test_kmeans", "", feature_column_names=[*iris_feature_column_names, "class"])
def test_submit_pai_random_forest_train_task(self): original_sql = """SELECT * FROM alifin_jtest_dev.sqlflow_iris_train TO TRAIN RandomForests WITH model.tree_num=3 LABEL class INTO e2e_test_random_forest;""" train(testing.get_datasource(), original_sql, "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", "RandomForests", "", feature_column_map, label_column, {"tree_num": 3}, { "feature_column_names": iris_feature_column_names, "label_meta": json.loads(label_column.get_field_desc()[0].to_json()) }, "e2e_test_random_forest_wuyi", None)
def test_submit_pai_kmeans_train_task(self): original_sql = """SELECT * FROM alifin_jtest_dev.sqlflow_iris_train TO TRAIN KMeans WITH model.excluded_columns="class", model.idx_table_name="alifin_jtest_dev.e2e_test_kmeans_output_idx" INTO e2e_test_kmeans;""" train( testing.get_datasource(), original_sql, "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", "KMeans", "", feature_column_map, None, { "excluded_columns": "class", "idx_table_name": "alifin_jtest_dev.e2e_test_kmeans_output_idx" }, {"feature_column_names": iris_feature_column_names}, "e2e_test_kmeans", None)
def test_submit_pai_train_task(self): model_params = dict() model_params["hidden_units"] = [10, 20] model_params["n_classes"] = 3 original_sql = """ SELECT * FROM alifin_jtest_dev.sqlflow_test_iris_train TO TRAIN DNNClassifier WITH model.n_classes = 3, model.hidden_units = [10, 20] LABEL class INTO e2etest_pai_dnn;""" train(testing.get_datasource(), original_sql, "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", "DNNClassifier", "", feature_column_map, label_column, model_params, {}, "e2etest_pai_dnn", None)
def test_submit_pai_train_task(self): model_params = dict() model_params["hidden_units"] = [10, 20] model_params["n_classes"] = 3 # feature_columns_code will be used to save the training information # together with the saved model. feature_columns_code = """{"feature_columns": [ tf.feature_column.numeric_column("sepal_length", shape=[1]), tf.feature_column.numeric_column("sepal_width", shape=[1]), tf.feature_column.numeric_column("petal_length", shape=[1]), tf.feature_column.numeric_column("petal_width", shape=[1]), ]}""" feature_columns = eval(feature_columns_code) train(testing.get_datasource(), "DNNClassifier", "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "", model_params, "e2etest_pai_dnn", None, feature_columns=feature_columns, feature_column_names=iris_feature_column_names, feature_column_names_map=iris_feature_column_names_map, feature_metas=iris_feature_metas, label_meta=iris_label_meta, validation_metrics="Accuracy".split(","), batch_size=1, epoch=1, validation_steps=1, verbose=0, max_steps=None, validation_start_delay_secs=0, validation_throttle_secs=0, save_checkpoints_steps=100, log_every_n_iter=10, load_pretrained_model=False, is_pai=True, feature_columns_code=feature_columns_code, model_repo_image="", original_sql=''' SELECT * FROM alifin_jtest_dev.sqlflow_test_iris_train TO TRAIN DNNClassifier WITH model.n_classes = 3, model.hidden_units = [10, 20] LABEL class INTO e2etest_pai_dnn;''')
def test_submit_xgb_train_task(self): original_sql = """SELECT * FROM iris.train TO TRAIN xgboost.gbtree WITH objective="multi:softprob", num_class=3, eta=0.4, booster="gbtree" validatioin.select="select * from alifin_jtest_dev.sqlflow_iris_test" LABEL class INTO e2etest_xgb_classify_model;""" model_params = { "eta": 0.4, "num_class": 3, "objective": "multi:softprob" } train_params = {"num_boost_round": 10} train(testing.get_datasource(), original_sql, "SELECT * FROM alifin_jtest_dev.sqlflow_iris_train", "SELECT * FROM alifin_jtest_dev.sqlflow_iris_test", "xgboost.gbtree", "", feature_column_map, label_column, model_params, train_params, "e2etest_xgb_classify_model", None)