Jeff Kaufman  ::  Blog Posts  ::  RSS Feed  ::  Contact

Slack tool: predict

I wrote a Slack tool that implements a CFAR-style prediction market:

/predict create rain-2017-03-18 "it will rain tomorrow" tomorrow 40%
/predict rain-2017-03-18 70%
/predict rain-2017-03-18 80%
/predict resolve rain-2017-03-18 true

A contract is some proposition that isn't known now, but will be known later, at which point it can be resolved true or false. When you create a contract, you give some details about how you'll resolve it, a time when it will close and stop taking new predictions, and some "house odds". These odds try and start the predicting in a reasonable place, so no one gets a big windfall from noticing things first.

When the market closes, people earn points in proportion to how much they improved the group consensus. [1] This isn't a traditional prediction market in the sense of having buyers and sellers. The downside is that it offers windfall profits to the first person to react to news, but the upside is that anyone can make a prediction at any time without needing to have a counterparty.

The code is on github. I've been using heroku to host it, but it can run anywhere. If you're having trouble adding it to slack let me know.


[1] Specifically, you get (or lose) points in proportion to the log of the ratio of your prediction to the one before. So if you predict 60%, I predict 70%, and it's resolved true, then I earn log(70/60) points. If it's resolved false we recast these predictions as if they were predicting the opposite, so 30% and 40%, and I earn (lose) log(30/40) points.

full post...

Diving into a floating point bug

Yesterday I refactored some python code that effectively changed:

   floor(n * (100 / 101))
into:
   floor(n * Decimal(100/101))
For most integers this doesn't change anything, but for multiples of 101 it gives you different answers:
  floor(101 * (100 / 101))       -> 100
  floor(101 * Decimal(100/101))  ->  99
In python2, however, both give 100:
  floor(101 * (100.0 / 101))       -> 100
  floor(101 * Decimal(100.0/101))  -> 100
What's going on? First, what's the difference between python2 and python3 here? One of the changes not listed in What's New In Python 3.0 is that floor now returns an int instead of a float:
  • 2.x: Return the floor of x as a float, the largest integer value less than or equal to x.
  • 3.x: Return the floor of x, the largest integer less than or equal to x. If x is not a float, delegates to x.__floor__(), which should return an Integral value.
Since these are positive numbers, we can use int() instead of floor() and now python2 and python3 give the same result:
  2.x: int(101 * Decimal(100.0/101)) -> 99
  3.x: int(101 * Decimal(100/101))   -> 99
The root of the problem is that 100/101 is a repeating decimal, 0.99009900..., and so can't be represented exactly as a Decimal or a float. To store it as a Decimal python defaults to 28 decimal digits and rounds it: more...
Housing Without Street Parking

One of the major reasons existing residents often oppose adding more housing is that as more people move in it gets harder to find on-street parking. [1] This gives us things like requirements that there be at least one off-street parking place per unit, or just prohibitions on building out. What if, in places like Somerville where all parking is already by-permit-only, we added a new category of housing unit, one that didn't come with any rights to street parking?

The requirements for building these would be lower, and they would end up renting somewhat more cheaply. I know a lot of people who don't own cars and walk / bike / taxi / take public transit everywhere, who I think would be happy to rent units classified this way. more...

Early Exercise and 83b

This is a post where I'm trying to figure out what I should do from a tax perspective. I'm not that knowlegable about taxes, but I still have to make a tax-relevant choice. So please read this as "Jeff writes down what he's currently thinking about how to make this decision" and not "Jeff tells me how to decide whether to early exercise."

Update 2017-03-07:: Ben Kuhn has a much better post, Stock options are really complicated. Go read that instead.

Update 2017-02-17: The modelling in this post is wrong to the point of not being useful. I had thought that the reason to exercise early was to get capital gains treatment on options, but ISOs already have this if you're careful with them. The reason to exercise early is the alternative minumum tax.

I recently started at a startup, and as is typical part of my compensation is in the form of stock options vesting over four years. I have two choices about how to handle this: more...

Carcassonne For Kids

Standard Carcassone is too complicated before about age 9, but if you adjust the rules (substantially) it can be a lot of fun with much younger kids. Stages of play:

  1. You just take turns playing tiles, and edges don't matter.
  2. Still just playing tiles, but now edges do matter.
  3. When you play a city tile, you can put a person on it, and when the city completes you get the person back.
  4. Same with roads.
  5. Same with monastaries.
  6. Start counting points and having a winner.
  7. Add farms

I've been playing stage #1 with Lily (nearly three years old) a lot lately, I've played stage #2 with a five year old, and stage #3 with a six year old. The exact rules don't matter that much, the important thing is to have fun and to teach the idea of playing a game that has rules you need to follow. For example, Lily wanted to play with the meeple as well, so we play that every time you put down a tile you also have to put a person on it.

more...

Role Term Survey Responses

As part of thinking about how whether non-gendered terms would work for mainstream contra dances, I thought it would be good to ask callers what they thought. Is it something where most callers were only willing to call Gents/Ladies, or are they more flexible? Do they generally support this sort of change, or do they think it's a bad idea?

I wrote to the callers who have called my local dance (BIDA) in the last year, plus the ones who are currently booked, to ask them whether:

  • A dance like BIDA switching to gender free terms is better, worse, or about the same.
  • They have a preference between Larks/Ravens and Jets/Rubies.
  • They would be willing to call Larks/Ravens or Jets/Rubies if a dance required that.

Of the 18 callers I wrote to, 17 responded. Of them, all but one was willing to call Larks/Ravens or Jets/Rubies, though several said (without my having suggested it) that they wouldn't be willing to call Lead/Follow.

Many of the respondents didn't say whether they were in favor of the switch. Of the 11 who did respond, it was 5x yes, 3x ambivalent, and 3x no.

Nine callers preferred Jets/Rubies because they find it easier to say, but no one so much that they were willing to call Jets/Rubies but not Larks/Ravens. more...

More Posts


Jeff Kaufman  ::  Blog Posts  ::  RSS Feed  ::  Contact  ::  G+ Profile