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
In the schelling_solutions.ipynb the last two lines of the function happy are:
num_same_type = sum(self.type == agent.type for agent in neighbors)
return num_same_type >= require_same_type
According to this code an agent is happy if at least require_same_type number of agents are of the same type as this agent.
This contradicts the text which says: "We will say that an agent is happy if half or more of her 10 nearest neighbors are of the same type".
First, the text clarifies that "They are perfectly happy if half their neighbors are of the other color" whereas here we are checking the number of other agents who are of the same color as this agent.
Second, earlier in the code require_same_type is set to 7 whereas to follow the text it should have been 6.
The text was updated successfully, but these errors were encountered:
I think I understand now. "We will say that an agent is happy if half or more of her 10 nearest neighbors are of the same type" means "of the same type as that agent" which is how it is in Schelling's paper.
@jmoy Many thanks for flagging these issues. Right now we're in the middle of a big reorganization to simplify structure and switch over to Python 3.5. Once those changes are merged we'll tidy this up.
In the
schelling_solutions.ipynb
the last two lines of the functionhappy
are:According to this code an agent is happy if at least
require_same_type
number of agents are of the same type as this agent.This contradicts the text which says: "We will say that an agent is happy if half or more of her 10 nearest neighbors are of the same type".
First, the text clarifies that "They are perfectly happy if half their neighbors are of the other color" whereas here we are checking the number of other agents who are of the same color as this agent.
Second, earlier in the code
require_same_type
is set to7
whereas to follow the text it should have been6
.The text was updated successfully, but these errors were encountered: