sql-machine-learning / models

Premade models for SQLFlow
Apache License 2.0
37 stars 17 forks source link

Add GCN #80

Closed Derek-Wds closed 4 years ago

Derek-Wds commented 4 years ago

Hi this is the PR about adding GCN to sqlflow, which relates to #2714, #78.

This sql command is used to train the model, which can produce a result of accuracy about 83% on validation dataset.

SELECT cora.node.id, features, label as class, cora.edge.from_node_id, cora.edge.to_node_id FROM cora.node
LEFT JOIN cora.edge ON (cora.node.id = cora.edge.from_node_id OR cora.node.id = cora.edge.to_node_id)
ORDER BY cora.node.id
TO TRAIN sqlflow_models.GCN
WITH model.nhid=16, model.nclass=7, 
     model.epochs=200, model.train_ratio=0.15, 
     model.eval_ratio=0.2, validation.metrics="CategoricalAccuracy"
COLUMN DENSE(features)
LABEL class
INTO sqlflow_models.gcn_model;

If there is any question, please let me know.

Derek-Wds commented 4 years ago

I have updated the codes following @lhw362950217 and @typhoonzero's suggestions. Thanks!