Beispiel #1
0
 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])
     """
     submitter.submit_pai_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)
Beispiel #2
0
 def test_submit_pai_random_forest_train_task(self):
     submitter.submit_pai_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)
Beispiel #3
0
 def test_submit_pai_kmeans_train_task(self):
     submitter.submit_pai_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"])
Beispiel #4
0
    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)

        submitter.submit_pai_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(","),
            save="model_save",
            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;''')