MCPcopy Create free account
hub / github.com/alibaba/graph-learn / sample

Method sample

graphlearn/python/gsl/dag_node.py:182–195  ·  view source on GitHub ↗

Sample count of neighbors for each upstream node. Args: count (int): For "full" strategy, the neighbors will be truncated by the given count if `count` > 0, otherwise, the real count of neighbors would return. For other sampling strategies, the returned neighbors w

(self, count)

Source from the content-addressed store, hash-verified

180 return self
181
182 def sample(self, count):
183 """Sample count of neighbors for each upstream node.
184
185 Args:
186 count (int): For "full" strategy, the neighbors will be truncated by
187 the given count if `count` > 0, otherwise, the real count of neighbors
188 would return. For other sampling strategies, the returned neighbors
189 would be padded with the given PaddingMode.
190 """
191 assert isinstance(count, int)
192 self._add_param(pywrap.kNeighborCount, count)
193 self._add_param(pywrap.kPartitionKey, pywrap.kSrcIds)
194 self._shape = (np.prod(self._shape), count)
195 return self
196
197 def by(self, strategy):
198 self._strategy = strategy

Callers 15

test_sample_edgeMethod · 0.45
test_negative_sampleMethod · 0.45
test_full_sampleMethod · 0.45
desc_queryMethod · 0.45
trainFunction · 0.45
meta_path_sampleFunction · 0.45
queryFunction · 0.45

Calls 1

_add_paramMethod · 0.95

Tested by 13

test_sample_edgeMethod · 0.36
test_negative_sampleMethod · 0.36
test_full_sampleMethod · 0.36
desc_queryMethod · 0.36
test_node_iterateFunction · 0.36
test_edge_iterateFunction · 0.36