Esempio n. 1
0
              "n_classes": 3,
              "hidden_units": [10, 20]
          },
          validation_metrics=["CategoricalAccuracy"],
          save="mymodel_keras",
          batch_size=1,
          epoch=3,
          verbose=0)
    pred(datasource=datasource,
         estimator_string="sqlflow_models.DNNClassifier",
         select=select,
         result_table="iris.predict",
         feature_columns=feature_columns,
         feature_column_names=feature_column_names,
         feature_column_names_map=feature_column_names_map,
         result_col_name=label_meta["feature_name"],
         feature_metas=feature_metas,
         model_params={
             "n_classes": 3,
             "hidden_units": [10, 20]
         },
         save="mymodel_keras",
         batch_size=1)
    os.unlink("mymodel_keras")

    train(datasource=datasource,
          estimator_string="sqlflow_models.RawDNNClassifier",
          select=select,
          validation_select=validate_select,
          feature_columns=feature_columns,
          feature_column_names=feature_column_names,
    train(datasource=datasource,
          estimator=sqlflow_models.DNNClassifier,
          select=select,
          validate_select=validate_select,
          feature_columns=feature_columns,
          feature_column_names=feature_column_names,
          feature_metas=feature_metas,
          label_meta=label_meta,
          model_params={
              "n_classes": 3,
              "hidden_units": [10, 20]
          },
          save="mymodel_keras",
          batch_size=1,
          epochs=3,
          verbose=0)
    pred(datasource=datasource,
         estimator=sqlflow_models.DNNClassifier,
         select=select,
         result_table="iris.predict",
         feature_columns=feature_columns,
         feature_column_names=feature_column_names,
         feature_metas=feature_metas,
         label_meta=label_meta,
         model_params={
             "n_classes": 3,
             "hidden_units": [10, 20]
         },
         save="mymodel_keras",
         batch_size=1)
Esempio n. 3
0
          select=select_binary,
          validate_select=validate_select_binary,
          feature_columns=feature_columns,
          feature_column_names=feature_column_names,
          feature_metas=feature_metas,
          label_meta=label_meta,
          model_params={
              "n_classes": 2,
              "hidden_units": [10, 20]
          },
          save="mymodel_binary",
          batch_size=1,
          epochs=3,
          verbose=1)
    pred(datasource=datasource,
         estimator=tf.estimator.DNNClassifier,
         select=select,
         result_table="iris.predict",
         feature_columns=feature_columns,
         feature_column_names=feature_column_names,
         result_col_name=label_meta["feature_name"],
         feature_metas=feature_metas,
         model_params={
             "n_classes": 3,
             "hidden_units": [10, 20]
         },
         save="mymodel",
         batch_size=1)
    shutil.rmtree("mymodel")
    shutil.rmtree("mymodel_binary")