Skip to content

Instantly share code, notes, and snippets.

View noblock.py
"""
https://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html
http://www.tornadoweb.org/en/stable/
https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html
"""
from IPython import get_ipython
from IPython.core.magic import register_cell_magic
from tornado import ioloop
from functools import partial
@josh-howes
josh-howes / fp_tree.py
Created Nov 17, 2015
Han, Pei and Yin's novel frequent pattern tree (FP-tree) structure
View fp_tree.py
"""Mining Frequent Patterns without Candidate Generation.
Naive implementation of the data structures in the following paper <http://hanj.cs.illinois.edu/pdf/sigmod00.pdf>
"""
class HeaderTable(dict):
"""Header Table.
To facilitate tree traversal, an item header table is built in which each item points to its
occurrence in the tree via a head of node-link. Nodes with the same item-name are linked in
@josh-howes
josh-howes / abstract_decorated.py
Last active Nov 13, 2015
Add Decorating of Abstract Class Methods
View abstract_decorated.py
from abc import ABCMeta, abstractmethod
import types
import time
from functools import wraps
def with_timing(f):
@wraps(f)
def wrapper(*args, **kwds):
time_start = time.time()