|
1 | 1 | from collections import defaultdict |
2 | | -from typing import DefaultDict, Tuple |
| 2 | +from typing import DefaultDict |
3 | 3 |
|
4 | 4 | import attr |
5 | 5 |
|
|
11 | 11 | @attr.s |
12 | 12 | class WideSampler(Sampler): |
13 | 13 |
|
14 | | - _pred_degs: DefaultDict[Tuple[str, str], int] = attr.ib( |
| 14 | + _pred_degs: DefaultDict[str, int] = attr.ib( |
15 | 15 | init=False, repr=False, factory=lambda: defaultdict(dict) |
16 | 16 | ) |
17 | 17 |
|
18 | | - _obj_degs: DefaultDict[Tuple[str, str], int] = attr.ib( |
| 18 | + _obj_degs: DefaultDict[str, int] = attr.ib( |
19 | 19 | init=False, repr=False, factory=lambda: defaultdict(dict) |
20 | 20 | ) |
21 | 21 |
|
22 | | - _neighbor_counts: DefaultDict[Tuple[str, str], int] = attr.ib( |
| 22 | + _neighbor_counts: DefaultDict[str, int] = attr.ib( |
23 | 23 | init=False, repr=False, factory=lambda: defaultdict(dict) |
24 | 24 | ) |
25 | 25 |
|
@@ -49,7 +49,7 @@ def fit(self, kg: KG) -> None: |
49 | 49 | else: |
50 | 50 | counter[vertex.name] = 1 |
51 | 51 |
|
52 | | - def get_weight(self, hop: Hop) -> int: |
| 52 | + def get_weight(self, hop: Hop) -> float: |
53 | 53 | """Gets the weight of a hop in the Knowledge Graph. |
54 | 54 |
|
55 | 55 | Args: |
|
0 commit comments