|
|
11:20 pm: Programming silliness
After the last batch of networking posts, and inspired by the models in The Social Atom, I spent this evening trying to generate a model for networking. It's not quite working yet, but I think I'm making progress. Part of the problem is that I'm using Python, a language I don't actually know. I've been meaning to learn Python for a while, and I have to admit it's pretty slick. The Windows shell kind of bites (I can't figure out how to make it let me load stuff into the shell from a file - it puts it into the file's namespace, which is fine for object classes, but annoying when I'm trying to set up one of those classes), but as a language, I can see why jofish22 and arcticturtle rave about it - after 15 minutes of flipping through a "Beginning Python" book, I was able to get started coding, and I could figure out pretty much everything I wanted to do within a couple minutes of flipping through reference guides. So the idea behind the model is to simulate the different kinds of networkers, and see if their networks evolve as I anticipate.
- I'll have an object for each person, where I track their connections and the strength of those connections
- Each "round", the person will choose whether to strengthen an existing connection or try to meet somebody new - this will be set on a person-by-person level to simulate introverts vs. extroverts.
- I'm playing around with how to manage the increased probability of making a new connection to a friend of a friend - right now, if your strong friend recommends their strong friend, it vastly increases the chance of the connection "sticking"
I'm guessing that if I get it running, it will show that connector type people (people who preferentially meet new people and have an advantage in making connections "stick" to represent their charisma) will end up with a dominant network, where they know everybody. Power laws and all that. Meanwhile, introverts will end up with small networks with strong connections because they prefer hanging out with people they already know. I'm a bit curious as to whether the power law of connector-hood will kick in even if I start everybody off with the same settings, just because once one person randomly gets a few more connections than other people, those connections will build on each other, increasing the size and power of that person's network. I kind of expect this, based on the work in The Social Atom and The Guy Theory I posited, but it'd be cool to see it play out. If nothing else, it will amuse me for a little while.
Comments
For #3, I'd say what to do is to have agents recommend their friends based on the strength of the connection, and it should fall out automatically. Okay. You have a population of agents. Each agent has an extroversion rating, which moderates how often it works on an existing connection versus trying to forge a new connection. It occurs to me there's another aspect of that, which is you might give the agents preferences for how strong they want their connections to be, which would bias whether it's working on its older strong connections or newer weak connections when it's doing maintenance. Anyway, if the agent wants to meet someone new, it picks one of its friends at random (biases by the strength of their connection) and then picks one of their friends (biased in the same way). The strong friends of strong friends will get picked more often that way, and so you'll automatically get more interactions with them. Many of those interactions will be with agents that are already known, but that's okay, it just means that it's shoring up an existing connection. The connectors will be good for meeting new people, but not for strengthening those ties. You'll either have to start with a bunch of random weak ties in your population or add a 'chance encounter' function that occasionally ties two completely unrelated agents together, otherwise you'll never be able to link disjoint subgraphs and it'll get weird. But I think that dynamic should produce the right kind of graph structure. Aside -- it strikes me that you don't actually need to have rounds. You should be able to get equivalent results by just picking one agent at random and having it have an encounter, and repeating, which will probably make the code simpler. There's a great Scientific American article by Barabasi & Bonabeau about why you get power laws in networks, which you can read here: http://icosystem.com/articles/scientific/SciAm2003.pdf . I mean, if I haven't already recommended that to you... Okay, this is really cool. Can I see your code when you've got it running?
Yeah, I actually was setting it up so that the agent either strengthens an existing connection (maxing out at some arbitrary number) or randomly picks an encounter with somebody it doesn't know in the population, with preference to friends of friends. Higher weight is given to unknowns who are recommended by multiple friends. Strength of connection determines whether the introduction "sticks" in the form of adding a connection.
But I might end up trying it your way too where strength of connection biases whether somebody gets chosen.
Oh, and good point on not having to have rounds - I think you're right, and that will make things easier.
Part of the reason I was thinking about rounds is that I have a weaken connections round, where every 10 rounds or something, all connection strengths are weakened, to simulate the regular maintenance we have to do of our social networks. I decided that you can't weaken a connection to non-existence - once a connection has been made, it's remembered - but over time, it weakens to "Hey, I know that name" level.
And yeah, I realize this is the same as Barabasi's stuff (I haven't actually read his book, but I read Six Degrees by Duncan Watts, which covered similar ground - thanks for the article, though - I'll read it tonight), but it's mostly an excuse to try some of these models out for myself, because they have interesting results.
I think both ways would work. Part of the reason I'd do it by the recommend-a-friend method is that my instinct is the code for that would be easier than whole-population-with-bias. But that's what experiments are for! If you've read Watts, you've mostly read Barabasi, and vice-versa. Something to be gained by reading both, but yeah, they cover a lot of the same territory. The article is a nice summary/refresher. And Bonabeau is a good name to look for in agent-based modeling research. Does this article look interesting? I can send you a copy, if so: http://www.pnas.org/cgi/content/abstract/99/suppl_1/2566I don't think it gets at the same things your model would get at, but it might have interesting points of tangency.
Heh. You may be right that the code would be easier the other way, but I already wrote most of the code the first way, so I'll try that first. Sure, send me the article - I don't think I'll understand it, but I'm curious. Plus I liked Steve Strogatz when I took 18.04 from him - he's the one that told us the Gauss was a prick story which endlessly amuses me. I'm not really doing anything new - I'm more interested in some of the "social physics" stuff mentioned in the Social Atom, and this is a good excuse to start building some of the infrastructure I'd need to play around with "agent-based modeling".
You may be doing something newer than you think. It's surprising how many obvious ideas in agent modeling have not been tried.
One of the nice things about agent-based modeling is that just writing code in a object-oriented language at all gets you, like, 90% of what you really need. The rest of it is all just gravy.
Do send me a copy of your code once it does something. I've been wanting to learn Python, and running up against the barrier of not having any projects for it. Modifying someone else's code to see what using a different algorithm does is *perfect*.
Yeah, object-oriented is perfect for this work. And since I have done enough programming to know how to reformat my brain to think that way, it's been relatively smooth sailing - I flipped through the book I stole from work to the chapter on creating classes, looked at a couple examples, and started typing.
I'd been having the same issue with learning Python (or Perl or anything, really). All the projects I came up with were lame ones that were clearly "I'm trying to think of something that will give me an excuse to learn this", like doing a Ruby on Rails implementation of my bookshelf something like LibraryThing. But this is something that actually interests me, so I have a small chance of finishing it :)
The other funny bit is that the only reason I really understand object-oriented coding is because of time playing with MUDs way back in the day. Monster and player classes and subclasses and all that. One of the silliest things I did at MIT was use the adventure game problem set in 6.001 to basically re-implement a MUD, with combat and hit points and things like that.
MUDding was also the reason I learned to touch type - not being able to type fast meant risking my character's death.
I should write a book on "Everything I needed to know I learned by MUDding".
Oh, and yes, of course you can see my code when it's running. Or even when it's not running if you really want.
Powered by LiveJournal.com
|