Skip to content

Instantly share code, notes, and snippets.

@pilipolio
pilipolio / testing_iterables_with_unittest.py
Created April 19, 2013 09:21
Example testing for sequence equality with unittest
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.expected_iterable = [0, 1, 2]
def test_identical_lists(self):
actual_iterable = [0, 1, 2]
self.assertSequenceEqual(actual_iterable, self.expected_iterable)
def test_one_value_off_actual(self):
actual_iterable = [0, 4, 2]
@pilipolio
pilipolio / testing_iterables_with_unittest.output
Created April 19, 2013 09:23
Output from testing_iterables_with_unittest.py
guillaume@kelmis:/scratch/events-warehouse-develop/events-warehouse (feature/13225DimUserIdTable)$ python testing_iterables_with_unittest.py
F.FF
======================================================================
FAIL: test_empty_actual (__main__.TestSequenceFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "testing_iterables_with_unittest.py", line 14, in test_empty_actual
self.assertSequenceEqual(actual_iterable, self.expected_iterable)
AssertionError: Sequences differ: [] != [0, 1, 2]
@pilipolio
pilipolio / C2B_Estimation.ipynb
Last active December 16, 2015 13:28
Illustrating the Chance to beat probability and its empirical calculation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pilipolio
pilipolio / GrokingTheBeta.ipynb
Created April 29, 2013 22:40
Trying to understand the Beta distribution, its link with the binomial and some benefits associated with the bayesian framework.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# "Chance to beat" or C2B empirical estimation
# <markdowncell>
# We define two and independent random variables $A$ and $B$ and their probability density, respectively $f_A :\mathbb{R} \mapsto [0;1]$ and $f_B: \mathbb{R} \mapsto [0;1]$. The "chance to beat" probability, or $C2B$, is the probability that a sample from $B$ is greater than a sample from $A$, i.e.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pilipolio
pilipolio / quick_tour.ipynb
Last active December 17, 2015 14:48
Quick demo of ipython & notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.