Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import beta as beta_dist
def credible_interval(t, f, prob=.5, prior='uniform'):
"""Calculates posterior credible interval for a beta-binomial model with prior `Beta(a, b)` after `t` successes in `t+f` trials.
@param t: Number of successes.
API_KEYS = {
'infura': "YOUR_INFURA_KEY",
'thegraph': "YOUR_THEGRAPH_KEY",
'etherscan': "YOUR_ETHERSCAN_KEY",
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@javipus
javipus / price-manipulation.ipynb
Last active July 31, 2023 07:11
Price oracle manipulation strategies
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@javipus
javipus / address.txt
Created February 8, 2021 10:23
Alfajores helloworld contract address
0x443140A42AC33de1a38ED9B853B8137542641960
@javipus
javipus / address.txt
Created February 8, 2021 10:00
Alfajores celo testnet address
0x995A18F41dcBE5186feFDF8c6aB2852519b9391A
% Prolog translation of the key functions in
% https://github.com/nearai/program_synthesis/blob/master/program_synthesis/algolisp/dataset/code_lisp.py
:- use_module(library(lists)).
:- use_module(library(dicts)).
% if ???
% if(context, cond, then, else).
% get Index-th element in list - alias of nth0 from lists library

INTRODUCTION

The goal is to solve two types of probability problems about sampling strings/multi-sets without replacement. The main differences between the two is permutation invariance. One example of each:

  • Problem type # 1: What is the probability of obtaining the sequence 'abb' when picking 3 letters without replacement from {a: 2, b: 3, z: 1}
  • Problem type # 2: What is the probability of picking 1 'd', 1 's' and 3 'g' when picking five letters without replacement from 'gggggggsggdgggg'?

In the naive setting, a transformer is used to map the question to the answer, e.g.

"""
I never cared about my machine's epsilon until I did.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Machine precision - in bits
prec = -int(np.log2(np.finfo(float).eps))
import time
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Understanding upper bounds for Brier scores through random predictors.
"""