Introduction

Python Module 1

Your first submission

Get on the leaderboard in minutes

Let's dive right in.  The video below shows how you can create a colab notebook, generate yourself an identity, start participating immediately, and log into the dashboard to track the rise or fall in your fortune. 

HubSpot Video

 

Here are the steps shown:

(a) Your identity

Just want a notebook to create keys? Here it is. First we install the microprediction package

pip install microprediction

If you are using colab, as I suggest in the video, you'll need a bang before pip.

Then we import

from microprediction import new_key, MicroWriter

And burn a key

write_key = new_key(difficulty=9)

which lets us instantiate a MicroWriter:

mw = MicroWriter(write_key=write_key)

We reveal the private write_key so you can cut and paste it into the dashboard

print(write_key)

You should keep this private, but we also show the public identity

print(mw.shash(write_key))

and the shorter, cuter, public identity

print(mw.animal_from_key(write_key))

 

(b) Your first submission

A submission is a list of 225 floating point numbers. You hope that some of them will be close to the truth, which will be revealed as the next update to the time series that occurs after a delay of 70 seconds. We will use 70 seconds as an example here, but you can find the list of possible delays at config.json or in the mw.DELAYS property. 

In the video we choose a so-called Z1-stream similar to z1~emojitracker-twitter-astonished_face~3555 because these values are, as we will learn later, roughly (standard) normally distributed. It is therefore not a terrible supposition to supply 225 numbers that are normally distributed with variance 1 and mean 0. 

import numpy as np

xs = list(np.random.randn(225))

And we can submit these for the 70 second ahead or more contest with a single MicroWriter command:

mw.submit(name="z1~emojitracker-twitter-astonished_face~3555.json", values=xs, delay=70)

That's all it takes. You can rush over to the dashboard to confirm that your submission was received, and then wait for your submission to be judged (over and over again, as new data arrives).

Bear in mind that this is not a one-off prediction. It is intended to represent your ongoing view as to the distribution of the next number to appear at this stream. We will learn more about z1-streams later, but this example is chosen because your one time submission will probably be pretty reasonable even if you never update it.

In general, that isn't true at all and thus, in future modules, we will discuss how to provide ongoing predictions of time series. 

 

 

Summary

It takes ten minutes and about as many lines of code to start participating in the prediction network.

No registration

You can create your own identity (write key)

Correct other's distributional errors

Our first submission attempts to predict the community implied z-score for emoji usage. We will learn more about z-scores in future modules. But briefly, if you think community predictions don't have fat enough tails, you can modify this example to take advantage of that view (or conversely).

Continue

In the next module we will show how to launch a crawler that predicts many time series.