Code Monkey home page Code Monkey logo

microprediction's Introduction

microprediction

Greetings. First up, here's a new game where you hurl a million 11-dimensional Monte Carlo samples at my server. It takes a few minutes to learn but, as they say, a lifetime to master. And while merely a game it might be the early stages of a novel statistical meritocracy - one poking at a slumbering $15 Trillion passive investment industry (whose choice of portfolio is correct on a set of measure zero, let's face it). Maybe you'll share in the rewards, but only for consistent longitudinal performance.

  1. Open this colab notebook or script (yes there's an R version),
  2. Change the email, at minimum,
  3. Run it. Every weekend.
  4. Check your scores at www.monteprediction.com

The notebook also describes the scoring mechanism. Ask questions in the slack (see bottom of leaderboard for slack invite).

Writings

See

If we don't know each other yet from LI or elsewhere, I'm an applied mathematician / practitioner and quant at heart with great respect for what I term the "Indispensable Markets Hypothesis" - a weaker form EMH. That's to say I like to provoke people into using market-inspired collective mechanisms for prediction. I used the options market to effortlessly beat 97% of participants in the year-long M6 contest - see the post or article.

My book is a meditation on the power of markets in a very specific yet ubiquitous domain: frequently repeated prediction. Read the awards and reviews.

Some repos here ...

Derivative-free optimizer comparisons

The humpDay package is intended to help you choose a derivative-free optimizer for your use case.

Schur Complementary Portfolios

My work on unifying Hierarchical Risk Parity with minimum variance portfolio optimization sits in the precise package although I've been meaning to put it somewhere else.

Incremental time-series and benchmarking

The timemachines package enumerates online methods and makes some effort to evaluate univariate methods against the corpus of time-series drawn from the microprediction platform. It is an attempt to reduce everything to relatively pure functions:

$$ f : (y_t, state; k) \mapsto ( [\hat{y}(t+1),\hat{y}(t+2),\dots,\hat{y}(t+k) ], [\sigma(t+1),\dots,\sigma(t+k)], posterior\ state)) $$

where $\sigma(t+l)$ estimates the standard error of the prediction $\hat{y}(t+l)$.

Benchmarking overview

Topic Package Elo ratings Methods Data sources
Univariate time-series timemachines Timeseries Elo ratings Most popular packages (list) microprediction streams
Global derivative-free optimization humpday Optimizer Elo ratings Most popular packages (list) A mix of classic and new objectives
Covariance, precision, correlation precise See notebooks cov and portfolio lists Stocks, electricity etc

These packages aspire to advance online autonomous prediction in a small way, but also help me notice if anyone else does.

Winning

The winning package includes my recently published fast algorithm for inferring relative ability from win probabilities, at any scale. As explained in the paper the uses extend well beyond the pricing of quinellas!

First Down

My firstdown repo contains analysis aspiring to ruin great game of football. See Wilmott paper and for heaven's sake, don't stretch out for the first down. That's obviously nuts.

Some other repos

  • embarrassingly - A speculative approach to robust optimization that sends impure objective functions to optimizers.
  • pandemic - Ornstein-Uhlenbeck epidemic simulation (related paper)

The currently defunct real-time time-series platform

The real-time system previously maintained by yours truly has entered a trisoloran dehydrated state but will hopefully be revived at a future date, after one of my three hundred ChatGPT generated scientific grant proposals is successful. Here's how some of the open-source stuff used to propagate down into the "algo fight club".

  1. The "/skaters" provide canonical, single-line of code access to functionality drawn from packages like river, pydlm, tbats, pmdarima, statsmodels.tsa, neuralprophet, Facebook Prophet, Uber's orbit, Facebook's greykite and more.

  2. The StreamSkater makes it easy to use any "skater".

  3. Choices are sometimes advised by Elo ratings, but anyone can do what they want.

  4. It's not too hard to use my HumpDay package for offline meta-param tweaking, et cetera.

  5. It's not too hard to use my precise package for online ensembling.

Those repose are:

  • The muid identifier package is explained in this video.
  • microconventions captures things common to client and server, and may answer many of your more specific questions about prediction horizons, et cetera.
  • rediz contains server side code. For the brave.
  • There are other rats and mice like getjson, runthis and momentum.

microprediction's People

Contributors

cclauss avatar ericzlou avatar farmhouse121 avatar karthiks416 avatar microprediction avatar ovvo-financial avatar pcotton-intech avatar rustyconover avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microprediction's Issues

get_transactions should support a cursor so all transactions can be retrieved, not just last n records.

When using get_transactions it seems to only return a fixed window of results, such as the last n.

If I'm working with many streams I may have more transactions than fit into that window of records. At this time there doesn't seems to be a way to have a cursor through the transaction records such that I can retrieve all of them in a reliable fashion from a fixed point in time.

By not having this I need to rely on the performance trackers per stream which not as granular. If you need me to clarify my use case I'm happy to.

from microprediction import MicroPoll, create_key doesn't work

This is found in one of the READMEs at the root of the repo.
For importing MicroPoll what seems to work is from microprediction.polling import MicroPoll

For create_key it is not clear. I found create_key methods in old_conventions.py but not a standalone function.
Maybe one needs something from the separate muid module (?)

Remove copulas from dependencies

Remove copulas from dependencies as we surely don't need this, do we?

That package insists on an old version of numpy and that kind of thing is a deal-breaker going forward

Graph bug

If the same data is pushed twice to the same stream resulting in data points like:

8/29 17:17:02 | 16
8/29 17:17:02 | 16

The graph does not deduplicate the time series leading to spikes being shown.

wrong return value in Microreader.get_lagged_times

In Microreader.get_lagged_times the return value is wrong, it says lagged_values should be lagged_times

   def get_lagged_times(self, name:str, count:int=1000) -> list:
        """ Retrieve lagged times
        :param name:    cop.json   z1~cop.json   z2~cop~qp.json
        :return: [ float ]
        """
        lagged_values, lagged_times = self.get_lagged_values_and_times(name=name, count=count)
        return lagged_values

get_delayed_value is returning NaN

This seems to have changed, my integration tests caught this.

JSON doesn't allow NaNs.

$ curl http://api.microprediction.org/live/delayed::70::South_Australia_Electricity_Price.json
NaN

$ curl http://api.microprediction.org/live/delayed::310::South_Australia_Electricity_Price.json
NaN

$ curl http://api.microprediction.org/live/delayed::910::South_Australia_Electricity_Price.json
NaN

install failure.

Seen this before

building 'accumulation_tree.accumulation_tree' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/accumulation_tree
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/nfs/i1/c/home/peter/virtual-envs/optim/include -I/usr/include/python3.7m -c accumulation_tree/accumulation_tree.c -o build/temp.linux-x86_64-3.7/accumulation_tree/accumulation_tree.o
accumulation_tree/accumulation_tree.c:4:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for accumulation-tree
Running setup.py clean for accumulation-tree
Failed to build accumulation-tree
Installing collected packages: contexttimer, muid, contextlib2, schema, pymorton, ordered-set, deepdiff, accumulation-tree, tdigest, microconventions, microprediction
^COperation cancelled by user

Fix exhalable cat

:50:01 Submitted to sateb_4.json 310s horizon, and will do so again in 118 seconds.
Nov 23 15:50:04 Submitted to sateb_7.json 70s horizon, and will do so again in 121 seconds.
Nov 23 15:50:05 Traceback (most recent call last):
Nov 23 15:50:05 File "/home/micropredictioncrawlers/crawlers/exhalable_cat.py", line 30, in
Nov 23 15:50:05 crawler.run()
Nov 23 15:50:05 File "/home/micropredictioncrawlers/.local/lib/python3.8/site-packages/microprediction/crawler.py", line 719, in run
Nov 23 15:50:05 self.predict_and_submit(name=name, delay=delay, lagged_times=lagged_times)
Nov 23 15:50:05 File "/home/micropredictioncrawlers/.local/lib/python3.8/site-packages/microprediction/crawler.py", line 482, in predict_and_submit
Nov 23 15:50:05 scenario_values = self.sample(lagged_values=lagged_values, lagged_times=lagged_times, name=name,
Nov 23 15:50:05 File "/home/micropredictioncrawlers/.local/lib/python3.8/site-packages/microprediction/fitcrawler.py", line 118, in sample
Nov 23 15:50:05 state = self.update_state(state=state, lagged_values=lagged_values, lagged_times=lagged_times)
Nov 23 15:50:05 File "/home/micropredictioncrawlers/.local/lib/python3.8/site-packages/microprediction/sequentialcrawler.py", line 59, in update_state
Nov 23 15:50:05 machine.update(value=value, dt=dt)
Nov 23 15:50:05 File "/home/micropredictioncrawlers/.local/lib/python3.8/site-packages/microprediction/univariate/expnormdist.py", line 48, in update
Nov 23 15:50:05 move = self.params['g2'] * math.tanh(self.params['g1'] * dy / self.params['g2'])
Nov 23 15:50:05 TypeError: 'NoneType' object is not subscriptable

Mac install fails

(qqq)  ~/Dev/AnacondaProjects/microprediction/ [microprediction] pip install microprediction
Collecting microprediction
Using cached microprediction-0.19.5-py3-none-any.whl (71 kB)
Collecting microconventions>=0.5.0
Using cached microconventions-0.5.4-py3-none-any.whl (16 kB)
Collecting apscheduler
Using cached APScheduler-3.9.1-py2.py3-none-any.whl (59 kB)
Collecting tdigest
Using cached tdigest-0.5.2.2-py3-none-any.whl (9.4 kB)
Collecting copulas
Using cached copulas-0.3.0-py2.py3-none-any.whl (44 kB)
Collecting genson
Using cached genson-1.2.2.tar.gz (34 kB)
Preparing metadata (setup.py) ... done
Collecting hyperopt
Using cached hyperopt-0.2.7-py2.py3-none-any.whl (1.6 MB)
Collecting pytz>=2021.3
Using cached pytz-2021.3-py2.py3-none-any.whl (503 kB)
Collecting contexttimer
Using cached contexttimer-0.3.3.tar.gz (4.9 kB)
Preparing metadata (setup.py) ... done
Collecting requests
Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting pycoingecko
Using cached pycoingecko-2.2.0-py3-none-any.whl (8.3 kB)
Collecting scikit-learn
Using cached scikit_learn-1.0.2-cp310-cp310-macosx_10_13_x86_64.whl (8.0 MB)
Collecting pandas
Using cached pandas-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl (11.5 MB)
Collecting numpy>=1.20.1
Using cached numpy-1.22.3-cp310-cp310-macosx_10_14_x86_64.whl (17.6 MB)
Collecting pathlib
Using cached pathlib-1.0.1.tar.gz (49 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute setup.py since setuptools is not available in the build environment.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.