SQLFlow > https://github.com/sql-machine-learning/sqlflow
訓(xùn)練模型
SELECT *
FROM iris.train --從元數(shù)據(jù)表讀數(shù)據(jù)
TRAIN DNNClassifier --選擇 DNN 分類器
WITH n_classes = 3, hidden_units = [10, 20] --設(shè)置分類數(shù)(訓(xùn)練數(shù)據(jù)是三分類)和 hidden layer
COLUMN sepal_length, sepal_width, petal_length, petal_width --選擇加入訓(xùn)練的數(shù)據(jù)列
LABEL iris.train.class --選擇標(biāo)注的 label 列
INTO sqlflow_models.my_dnn_model; --保存模型
用訓(xùn)練好的模型預(yù)測一組數(shù)據(jù)的 label
SELECT *
FROM iris.test --從待預(yù)測的數(shù)據(jù)表讀數(shù)據(jù)( sepal_length, sepal_width, petal_length, petal_width 有數(shù)據(jù)层玲,但 label 為空)
PREDICT iris.predict.class --待填充的 label 數(shù)據(jù)列
USING sqlflow_models.my_dnn_model; --選擇已訓(xùn)練好的模型