You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

feature.py 1.5 kB

3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. envs='dgl pyg'.split()
  2. forbids=dict(zip(envs,"torch_geometric dgl".split()))
  3. import os
  4. from utils import *
  5. import sys
  6. def func(dev,env):
  7. sys.modules[forbids[env]]=None
  8. os.environ['AUTOGL_BACKEND']=env
  9. from autogl.backend import DependentBackend
  10. print('using backend :',DependentBackend.get_backend_name())
  11. from autogl.datasets import build_dataset_from_name
  12. data = build_dataset_from_name('cora')
  13. from autogl.module.preprocessing.feature_engineering import OneHotFeatureGenerator,EigenFeatureGenerator,GraphletGenerator,PageRankFeatureGenerator,LocalDegreeProfileGenerator,NormalizeFeatures,OneHotDegreeGenerator
  14. from autogl.module.preprocessing.feature_engineering import IdentityFeature, AutoFeatureEngineer
  15. from autogl.module.preprocessing.feature_engineering import FilterConstant, GBDTFeatureSelector
  16. from autogl.module.preprocessing.feature_engineering import NetLSD,NXLargeCliqueSize
  17. fes=[OneHotFeatureGenerator,EigenFeatureGenerator,GraphletGenerator,LocalDegreeProfileGenerator,NormalizeFeatures,OneHotDegreeGenerator]
  18. exceptions=[]
  19. for fe in fes:
  20. try:
  21. print(f'Doing {fe}')
  22. fe = fe()
  23. data=fe.fit_transform(data,inplace=False)
  24. except Exception as e:
  25. print(e)
  26. exceptions.append([fe,e])
  27. if len(exceptions)==0:
  28. return 'Test OK'
  29. return exceptions
  30. # func(0,'dgl')
  31. results=mp_exec([0,1],envs,func)
  32. print(results)