You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameter weighted in GraphSAGENodeGenerator, if weighted=True, is the sampling process sampling the first n nodes with the highest weight? Is it possible to interpret the weighted undirected graph as the original input data?
The text was updated successfully, but these errors were encountered:
I reached the definition of "naive_weighted_choices":
def naive_weighted_choices(rs, weights, size=None):
"""
Select indices at random, weighted by the iterator `weights` of
arbitrary (non-negative) floats. That is, `x` will be returned
with probability `weights[x]/sum(weights)`.
For doing a single sample with arbitrary weights, this is much (5x
or more) faster than numpy.random.choice, because the latter
requires a lot of preprocessing (normalized probabilties), and
does a lot of conversions/checks/preprocessing internally.
"""
probs = np.cumsum(weights)
total = probs[-1]
if total == 0:
# all weights were zero (probably), so we shouldn't choose anything
return None
thresholds = rs.random() if size is None else rs.random(size)
idx = np.searchsorted(probs, thresholds * total, side="left")
return idx
So, the weights are normalized by the sum of weights, then are converted into probabilities.
The parameter weighted in GraphSAGENodeGenerator, if weighted=True, is the sampling process sampling the first n nodes with the highest weight? Is it possible to interpret the weighted undirected graph as the original input data?
The text was updated successfully, but these errors were encountered: