-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Understanding the r
parameter in nearby_ids
#565
Comments
Your post is long and it will take me some time to read and reply. Quick answer on the first question: "Standard distance according to the space metric." means that when you create |
This might be a bug, I'll return here once I have more time to read the full code you paste. |
Not the complete picture, but
Your space has been set to a maximum of one in any direction. Since |
@Libbum thank you and it makes sense, but I've tested here with say an julia> r = 1;
julia> for i in 1:10
m = model_initialize(1000,2, 100, r )
maximum([Distances.euclidean(m[cid].pos,m[nid].pos)
for (cid,nid) in m.properties[:pointsdict]]) |> println
end
#= 9.695498878763921
13.674575357835351
13.252550529785903
9.974019672427724
9.875425090648458
9.887215555446176
9.754798725473133
9.807639365571072
9.728916662458216
13.321711803841492
=#
julia> r = 2
2
julia> for i in 1:10
m = model_initialize(1000,2, 100, r )
maximum([Distances.euclidean(m[cid].pos,m[nid].pos)
for (cid,nid) in m.properties[:pointsdict]]) |> println
end
#=
9.568065496062083
9.87265005574368
9.46048586970795
12.681313962716818
12.487125144176273
12.875428923136857
9.494411136950713
9.59346749363167
10.00765614970002
9.955890829815404
=# |
I think the problem was that periodic was true! Now it all makes sense. If I'm going around the space doubling the r won't change a thing, since we already wrapped the space. The exact keyword still does not give the exact bound, but that may be due to floating-point errors, and for my application, it is not a problem. |
c.f. also #566 |
I am trying to understand what the r parameter does in the
nearby_ids
procedure, specifically in the continuous case. In the docs the following is said: " Standard distance according to the space metric." Could someone elaborate to someone whose mathematical training is limited to calculus and linear algebra (I completely understand if y'all are busy!!) ? What is the change in behavior that changing r will have in the procedure?I am writing a simulation in which I set some "central" points and want to get nearby points. So, I wrote some code to explore it. However, when I set r to 1, and exact to true, and test the euclidean distance (from the central points) I get a distance of ~1.2, which is not the behavior I was expecting. However, when I set r to 2 I still get a distance of 1.2! Doubling r does not change the euclidean distance of the points sampled using the nearby_ids procedure.
So, the code above shows what I'm saying. I admit I don't really understand what the r parameter does here and changing it doesn't seem to change the radius of what is being sampled in that code.
The text was updated successfully, but these errors were encountered: