MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / TestStepTrainSQL

Function TestStepTrainSQL

go/step/step_test.go:33–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestStepTrainSQL(t *testing.T) {
34 if os.Getenv("SQLFLOW_TEST_DB") != "mysql" {
35 t.Skip("skip no mysql test.")
36 }
37 a := assert.New(t)
38 session := makeTestSession(database.GetTestingMySQLURL())
39
40 sql := `SELECT * FROM iris.train WHERE class!=2
41 TO TRAIN DNNClassifier
42 WITH
43 model.n_classes = 2,
44 model.hidden_units = [10, 10],
45 train.batch_size = 4,
46 validation.select = "SELECT * FROM iris.test WHERE class!=2",
47 validation.metrics = "Accuracy,AUC"
48 LABEL class
49 INTO sqlflow_models.mytest_model;`
50 table, e := tablewriter.Create("ascii", 100, os.Stdout)
51 a.NoError(e)
52 out, e := GetStdout(func() error { return RunSQLProgramAndPrintResult(sql, "", session, table, false, false) })
53 a.NoError(e)
54 a.Contains(out, "Done training")
55}
56func TestImage(t *testing.T) {
57 a := assert.New(t)
58 a.True(isHTMLCode("<div></div>"))

Callers

nothing calls this directly

Calls 5

GetTestingMySQLURLFunction · 0.92
CreateFunction · 0.92
GetStdoutFunction · 0.85
makeTestSessionFunction · 0.70

Tested by

no test coverage detected