Skip to content

Commit b892548

Browse files
author
ZW-ZHANG
committed
update v0.3.1
1 parent 44ab9bd commit b892548

38 files changed

+2205
-224
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
% [![Documentation Status](http://mn.cs.tsinghua.edu.cn/autogl/documentation/?badge=latest)](http://mn.cs.tsinghua.edu.cn/autogl/documentation/?badge=latest)-->
1212

1313
## 最新消息
14-
14+
- 2021.4.19 v0.3.1版本更新!首次更新中文教程!
1515
- 2021.12.31 v0.3.0-pre版本更新!
1616
- 智图目前支持[__Deep Graph Library (DGL)__](https://www.dgl.ai/)作为后端,以方便DGL的用户使用。目前在DGL后端已经支持同构图的节点分类、链接预测以及图分类等任务。智图现在也可兼容PyG 2.0版本。
1717
- 智图可以支持__异构图__节点分类任务!详情请参考[异构图教程](http://mn.cs.tsinghua.edu.cn/autogl/documentation/docfile/tutorial/t_hetero_node_clf.html)

README_en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An autoML framework & toolkit for machine learning on graphs.
44

55
*Actively under development by @THUMNLab*
66

7-
Feel free to open <a href="https://github.com/THUMNLab/AutoGL/issues">issues</a> or contact us at <a href="mailto:autogl@tsinghua.edu.cn">autogl@tsinghua.edu.cn</a> if you have any comments or suggestions!
7+
Feel free to open <a href="https://www.gitlink.org.cn/THUMNLab/AutoGL/issues">issues</a> or contact us at <a href="mailto:autogl@tsinghua.edu.cn">autogl@tsinghua.edu.cn</a> if you have any comments or suggestions!
88

99
<!--
1010
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
@@ -113,7 +113,7 @@ pip install autogl
113113
Run the following command to install this package from the source.
114114

115115
```
116-
git clone https://github.com/THUMNLab/AutoGL.git
116+
git clone https://gitlink.org.cn/THUMNLab/AutoGL.git
117117
cd AutoGL
118118
python setup.py install
119119
```

autogl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
train,
1717
)
1818

19-
__version__ = "0.3.0-pre"
19+
__version__ = "0.3.1"

autogl/module/feature/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
from ._selectors import (
3434
FilterConstant, GBDTFeatureSelector
3535
)
36+
from ._auto_feature import (
37+
IdentityFeature, OnlyConstFeature, AutoFeatureEngineer
38+
)
3639

3740
__all__ = [
3841
"BaseFeatureEngineer",
@@ -61,5 +64,8 @@
6164
"NXGlobalEfficiency",
6265
"NXIsEulerian",
6366
"FilterConstant",
64-
"GBDTFeatureSelector"
67+
"GBDTFeatureSelector",
68+
"IdentityFeature",
69+
"OnlyConstFeature",
70+
"AutoFeatureEngineer"
6571
]

autogl/module/feature/_auto_feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def __init__(
166166
verbosity: int = 0,
167167
*args, **kwargs
168168
):
169-
super(AutoFeatureEngineer, self).__init__(multi_graph=False)
169+
super(AutoFeatureEngineer, self).__init__()
170170
self._ops = [op_sum, op_mean, op_max, op_min]
171171
self._sim = cosine_similarity
172172
self._fixlen = fix_length
@@ -208,7 +208,7 @@ def _fit(self, homogeneous_static_graph: autogl.data.graph.GeneralStaticGraph):
208208
for u, v in homogeneous_static_graph.edges.connections.t().numpy():
209209
neighbours[u].append(v)
210210
self.__neighbours: _typing.Sequence[np.ndarray] = tuple(
211-
[np.ndarray(v) for v in neighbours]
211+
[np.array(v) for v in neighbours]
212212
)
213213

214214
x: np.ndarray = _original_features.numpy()

autogl/module/feature/_base_feature_engineer/_base_feature_engineer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def transform(self, dataset, inplace: bool = True):
2929
return dataset
3030

3131
def fit_transform(self, dataset, inplace: bool = True):
32-
return self.fit_transform(dataset, inplace)
32+
for fe in self.fe_components:
33+
dataset = fe.fit(dataset)
34+
for fe in self.fe_components:
35+
dataset = fe.transform(dataset)
36+
return dataset
3337

3438
def __init__(self, feature_engineers: _typing.Iterable[_AbstractBaseFeatureEngineer]):
3539
self.__fe_components: _typing.List[_AbstractBaseFeatureEngineer] = []

autogl/module/feature/_base_feature_engineer/_base_feature_engineer_dgl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def fit(self, dataset):
4040
with torch.no_grad():
4141
for i, data in enumerate(dataset):
4242
dataset[i] = self.__postprocess(
43-
self._postprocess(self._transform(self._fit(self._preprocess(self.__preprocess(data)))))
43+
self._postprocess(self._fit(self._preprocess(self.__preprocess(data))))
4444
)
4545
return dataset
4646

autogl/module/feature/_base_feature_engineer/_base_feature_engineer_pyg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def fit(self, dataset):
2525
with torch.no_grad():
2626
for i, data in enumerate(dataset):
2727
dataset[i] = self.__postprocess(
28-
self._postprocess(self._transform(self._fit(self._preprocess(self.__preprocess(data)))))
28+
self._postprocess(self._fit(self._preprocess(self.__preprocess(data))))
2929
)
3030
return dataset
3131

autogl/module/feature/_selectors/_basic.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ def __transform_homogeneous_static_graph(
1616
) -> GeneralStaticGraph:
1717
if (
1818
'x' in static_graph.nodes.data and
19-
self._selection not in (Ellipsis, None) and
20-
isinstance(self._selection, torch.Tensor) and
21-
torch.is_tensor(self._selection) and self._selection.dim() == 1
19+
isinstance(self._selection, (torch.Tensor, np.ndarray))
2220
):
2321
static_graph.nodes.data['x'] = static_graph.nodes.data['x'][:, self._selection]
2422
if (
2523
'feat' in static_graph.nodes.data and
26-
self._selection not in (Ellipsis, None) and
27-
isinstance(self._selection, torch.Tensor) and
28-
torch.is_tensor(self._selection) and self._selection.dim() == 1
24+
isinstance(self._selection, (torch.Tensor, np.ndarray))
2925
):
3026
static_graph.nodes.data['feat'] = static_graph.nodes.data['feat'][:, self._selection]
3127
return static_graph

autogl/module/feature/_selectors/_gbdt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def _gbdt_generator(
4141
)
4242

4343
num_classes: int = torch.max(data.y).item() + 1
44+
parameters["num_class"] = num_classes
4445
__optimizer_parameters = {
4546
"num_boost_round": 100,
4647
"early_stopping_rounds": 5,
@@ -78,7 +79,7 @@ def _gbdt_generator(
7879
train_x = pd.DataFrame(x, columns=feature_index, index=None)
7980
dtrain = lightgbm.Dataset(train_x, label=label)
8081
clf = lightgbm.train(
81-
train_set=dtrain, params=params,
82+
train_set=dtrain, params=parameters,
8283
**__optimizer_parameters
8384
)
8485

0 commit comments

Comments
 (0)