-
Notifications
You must be signed in to change notification settings - Fork 917
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
Added homophily ratio in basic schelling example #2520
base: main
Are you sure you want to change the base?
Conversation
@@ -13,7 +13,7 @@ def __init__( | |||
width: int = 40, | |||
density: float = 0.8, | |||
minority_pc: float = 0.5, | |||
homophily: int = 3, | |||
homophily_ratio: float = 0.3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 0.3? It would make more sense to go to 3/8 (8 is the neighborhood size of a Moore grid with a radius of 1 and all fields occupied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing. I will change 0.3 to 3/8 (0.375).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quaquel The step size of the slider is 0.1. So the ratio can either be 0.3 or 0.4.
If the ratio is 0.3, agents with 3 similar neighbors and 8 total neighbors will be happy, as 3/8 = 0.375.
And if the ratio is 0.4, agents with 3 similar neighbors and 8 total neighbors won't be happy.
So should I change 0.3 to 0.4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can change the step size to 0.125 as well?
Thanks for the PR! Could you update your PR description to contain all the necessary information to understand this change on its own? You can use this template if you want. Edit: I saw there's also this PR open, which also modifies schelling: Are there any conflicts between them? I would tend to let #2518 go first, since it was opened earlier. (or did we assign someone to this specific issue?) |
@EwoutH Thank you for the reply. |
I have provided feedback in #2518, if that is not addressed in the coming days and there is no further response, I am fine with merging this instead. |
@quaquel Thank you. I understand. |
@EwoutH May you please run the benchmark tests? |
@quaquel @EwoutH Previously the benchmark tests were failing because I changed |
Performance benchmarks:
|
Looks like benchmarks ran, but performance is not up to the mark. So changing |
Thanks for your work. We’re currently waiting on #2518 to be performance validated, one that’s done we can continue with rebasing this PR and checking it’s performance properly. It’s great it now runs without problem! |
Thank you |
I have merged #2518, so let us know if you want to rebase this and further refine the example. |
@quaquel Yes, I would like to refine this. A few things that I think can be updated are:
|
Great, make sure to git rebase first and resolve merge conflicts. |
aedb32f
to
725c880
Compare
@quaquelI @EwoutH I was running scheduling example locally, which is currently committed at the main branch (not my pull request). But after I pressed the reset button, the grid shape changed, and it behaved normally, and agents are getting happy according to condition. Please see the below image: I remember 2 weeks back when I ran it; it was running fine even without pressing reset, although the grid shape changed back then also. |
77b20e4
to
4132e43
Compare
@quaquel I have added changes in my latest update, which I feel are correct. Please only see the latest update and ignore the rest before it. The changes also fix the problem that I mentioned above. |
Performance benchmarks:
|
benchmarks/configurations.py
Outdated
@@ -47,7 +47,7 @@ | |||
"parameters": { | |||
"height": 100, | |||
"width": 100, | |||
"homophily": 8, | |||
"homophily": 0.4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was 8 (the max for moore neighborhood, so it should be 1 now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quaquel I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor point remaining
@quaquel I am assuming you are referring to the step size of the slider. Should I change slider step size from 0.1 to 0.125? Then it also makes sense to change the required homophily ratio from 0.4 to 0.375. |
@quaquel I have made the changes. Please check. |
Changed homophily comparing logic as per discussion in #2515.
Now homophily_ratio is checked for agents to be happy. homophily_ratio is similar neighboring agents divided by the total number of neighbors.