dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.49k stars 3.02k forks source link

solver fails in unsupervised graphsage #1490

Closed naveenkumarmarri closed 4 years ago

naveenkumarmarri commented 4 years ago

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

  1. python3 examples/pytorch/graphsage/train_sampling_unsupervised.py
/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/sklearn/linear_model/logistic.py:433: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.
  FutureWarning)
Traceback (most recent call last):
  File "graphsage_sampling_unsup.py", line 336, in <module>
    run(args, device, data)
  File "graphsage_sampling_unsup.py", line 288, in run
    eval_acc, test_acc = evaluate(model, g, g.ndata['features'], labels, train_nid, val_nid, test_nid, args.batch_size, device)
  File "graphsage_sampling_unsup.py", line 216, in evaluate
    return compute_acc(pred, labels, train_nids, val_nids, test_nids)
  File "graphsage_sampling_unsup.py", line 193, in compute_acc
    lr.fit(emb[train_nids], labels[train_nids])
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/sklearn/linear_model/logistic.py", line 1294, in fit
    len(self.classes_))
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/sklearn/linear_model/logistic.py", line 473, in _check_multi_class
    "a multinomial backend." % solver)
ValueError: Solver liblinear does not support a multinomial backend.

Expected behavior

No error when I change https://github.com/dmlc/dgl/blob/master/examples/pytorch/graphsage/train_sampling_unsupervised.py#L192 to

lr = lm.LogisticRegression(multi_class='multinomial', max_iter=10000, solver='newton-cg')

Environment

Additional context

BarclayII commented 4 years ago

Hi,

Scikit-learn 0.22 and later changed the default optimizer from liblinear to LBFGS so the code should work fine as is.