Skip to content
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

Moran process #534

Merged
merged 8 commits into from
Apr 14, 2016
Merged

Moran process #534

merged 8 commits into from
Apr 14, 2016

Conversation

marcharper
Copy link
Member

Closes #224

The Moran process is somewhat of a hybrid of a match and a tournament. It's sort of a n >= 2 match, but also has several rounds. The process is widely studied in the literature.

Doc tests to skip

Doctest

Add Moran doc to toc tree

def play(self):
"""Play the process out to completion."""
while True: # O_o
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this inline comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary

@drvinceknight
Copy link
Member

This looks really great @marcharper, I'm heading to class now. Going to take another look at it later.

Docstring improvement

More review updates
if self.noise:
return True
else:
return any(p.classifier['stochastic'] for p in self.players)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This method is almost identical to the one in the Match class. I think they both ought to be abstracted out somewhere.

@drvinceknight
Copy link
Member

@marcharper the winner method returns the str of the player. This is in contrast to the Match class which returns the actual winning player instance. I understand why this is (this is an evolutionary process so an actual winner is not a particular player but a strategy). Could we change the name of this method to something that clarifies that:

  • winning_strategy_name
  • winner_name

? Not too sure what but I don't like that the type of Match.winner() and Moran.winner() is different.

@drvinceknight
Copy link
Member

One of my comments on the docs seemed to have been described as 'on an outdated diff':

On further_topics/probabilistict_end_tournaments.rst we have:

>>> results = tournament.play()
>>> m = results.payoff_matrix
>>> for row in m:  
...     print([round(ele, 1) for ele in row]) # Rounding output  

Perhaps do that in the docs here for consistency?

The sequence of populations::

>>> import pprint
>>> pprint.pprint(mp.populations) # doctest: +SKIP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the base print below, do we want the same here for consistency? (minor)

@drvinceknight
Copy link
Member

A part from my pprint/print comment inline my one remaining comment about the docs would be whether it should sit in getting_started or if it was better suited further_topics where for example the probabilistic ending tournament sits?

@marcharper
Copy link
Member Author

I think pprint does a better job in less code in this case -- I don't have an opinion on the docs, whatever you think is best is fine.

@drvinceknight
Copy link
Member

I think pprint does a better job in less code in this case.

Fine.

@drvinceknight
Copy link
Member

whatever you think is best is fine.

Can you move it to further_topics then? It feels better there to me. I would put it between Morality Metrics and Probabilistic Ending Tournaments.

More review updates

more review
@marcharper
Copy link
Member Author

Ok, but I'd say the same logic applies to the ecological variant, no?

@drvinceknight
Copy link
Member

Ok, but I'd say the same logic applies to the ecological variant, no?

I think that given that it comes out of the standard tournament/results class (it's a simple manipulation of the payoff matrix) I'd suggest that it should stay there. The moran process is as you said a different type of interaction all together...

Fix doc test
@marcharper
Copy link
Member Author

I've moved it but I don't agree with your position. IMO the main value of the library comes from

  • the library of strategies
  • the test suite
  • the classes that run matches and tournaments

The ecological variant is somewhat of a side curiosity that isn't going to excite anyone about the library; the Moran process and other population dynamics that are actively studied would actually be of interest to other researchers. Just because the ecological variant falls out of the results for the tournament code doesn't really make it a first class citizen. I could code the Moran process to use the tournament objects to run its matches and achieve the same effect.

@drvinceknight
Copy link
Member

I've moved it but I don't agree with your position. IMO the main value of the library comes from

Thanks :) Have marked this with a positive review.

the library of strategies
the test suite
the classes that run matches and tournaments

I completely agree. I would suggest a 4th strength is the accessibility of the library: a few people have been introduced to dev, game theory and open source through it (something I'm completely delighted about).

The ecological variant is somewhat of a side curiosity that isn't going to excite anyone about the library; the Moran process and other population dynamics that are actively studied would actually be of interest to other researchers. Just because the ecological variant falls out of the results for the tournament code doesn't really make it a first class citizen. I could code the Moran process to use the tournament objects to run its matches and achieve the same effect.

I see what you're saying and understand/agree that from a high level game theoretic research point of view (which is certainly what the library is) that the moran process is far more of interest. However, I think the getting started tutorial should perhaps be aimed also at people who have very little knowledge of game theory. Explaining that the eco variant is based on the payoff matrix is simpler and more immediately accessible than a different interaction type: as you said the moran process is a hybrid of an n player match and a tournament.

I do not at all mean that the moran process is a second citizen (far from it, and apologies if that is how I came across with this awesome contribution of yours), I just don't feel it's what's needed in the introduction (which is not only aimed at experts in game theory but also complete novices). I am 98% sure that with some of my students for whom I've said "work through the intro", I would have probably said "except the moran process", only because it requires them to create a different class to the Tournament, Results, Plot (some of my students have come to the library with not the strongest code/game theory background).

No doubt experts/researchers would perhaps even come looking for the moran process and I don't think it's too hard to find (just as for the probabilistic ending tournaments).

Anyway, sorry, I realise you were trying to put this to bed (perhaps we can open issue if we should chat about this further: onboarding is important to get right). I just wanted to make sure you didn't think I thought this was a second class citizen. I really do think it's awesome and am excited to learn more about it. The fact that it's heavily used in the literature is awesome. :) 👍

@drvinceknight
Copy link
Member

Tournament, Results, Plot (some of my students have come to the library with not the strongest code/game theory background).

Having written that and realised that we need the Eco class...

Perhaps moving the ecological variant to the Further topics is the way to go. I'll leave it up to you :), either of these is fine by me:

  • As is.
  • Both ecological and Moran in further (perhaps this further simplifies the intro which is even better).

@marcharper
Copy link
Member Author

Let's discuss in a future PR / on gitter. I agree that accessibility is both important and valuable aspect of the library.

I think this one is good to go in pending a second review.

@langner
Copy link
Member

langner commented Apr 14, 2016

Good stuff!

My opinion about the docs: create something like beyond_basics.rst which mentions both moran and eco and links to pages that expound on those topics. I would also put noisy tournaments in that bucket. In my mind, getting started should contain only the absolute basics; it should be geared towards people that have just learned about IPD yesterday, maybe this is also the first they've seen the words "game" and "theory" next to each other.

@marcharper marcharper mentioned this pull request Apr 14, 2016
@drvinceknight
Copy link
Member

@meatballs this is good to go I believe (assuming you're happy). The conversation about the docs has been moved to #536 :)

@meatballs meatballs merged commit 737fd4e into Axelrod-Python:master Apr 14, 2016
@marcharper marcharper deleted the moran-process branch April 16, 2016 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants