torch_geometric.transforms.AddRandomMetaPaths

class AddRandomMetaPaths(metapaths: List[List[Tuple[str, str, str]]], drop_orig_edge_types: bool = False, keep_same_node_type: bool = False, drop_unconnected_node_types: bool = False, walks_per_node: Union[int, List[int]] = 1, sample_ratio: float = 1.0)[source]

Bases: BaseTransform

添加类似于AddMetaPaths的额外边类型。 关键区别在于,添加的边类型是通过沿元路径的多次随机游走给出的。 为了达到与AddMetaPaths竞争的性能,可能需要通过walks_per_node增加随机游走的次数。

Parameters:
  • metapaths (List[List[Tuple[str, str, str]]]) – The metapaths described by a list of lists of (src_node_type, rel_type, dst_node_type) tuples.

  • drop_orig_edge_types (bool, optional) – If set to True, existing edge types will be dropped. (default: False)

  • keep_same_node_type (bool, optional) – If set to True, existing edge types between the same node type are not dropped even in case drop_orig_edge_types is set to True. (default: False)

  • drop_unconnected_node_types (bool, optional) – If set to True, will drop node types not connected by any edge type. (default: False)

  • walks_per_node (int, List[int], optional) – 每个起始节点在元路径中的随机游走次数。(默认值:1

  • sample_ratio (float, optional) – 源节点开始随机游走的比例。(默认值:1.0