A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix | |
;; and optionally can refer functions to the current ns. | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; | |
;; * :refer-clojure affects availability of built-in (clojure.core) | |
;; functions. |
""" | |
Implementation of pairwise ranking using scikit-learn LinearSVC | |
Reference: | |
"Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich, | |
T. Graepel, K. Obermayer 1999 | |
"Learning to rank from medical imaging data." Pedregosa, Fabian, et al., | |
Machine Learning in Medical Imaging 2012. |
""" | |
Implementation of pairwise ranking using scikit-learn LinearSVC | |
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich, | |
T. Graepel, K. Obermayer. | |
Authors: Fabian Pedregosa <[email protected]> | |
Alexandre Gramfort <[email protected]> | |
""" |
/* VT100 terminal reset (<ESC>c) */ | |
console.log('\033c'); | |
/* numbers comparations */ | |
> '2' == 2 | |
true | |
> '2' === 2 |
import asyncio | |
import random | |
q = asyncio.Queue() | |
async def producer(num): | |
while True: | |
await q.put(num + random.random()) | |
await asyncio.sleep(random.random()) |
import pandas as pd | |
from hashlib import sha256 | |
from pandas.util import hash_pandas_object | |
from functools import lru_cache | |
class HashableDataFrame(pd.DataFrame): | |
def __init__(self, obj): | |
super().__init__(obj) |
''' | |
This file is heavily inspired by https://github.com/j-towns/ans-notes/blob/master/rans.py | |
We describe a variant of bits-back coding called BB-Huffman. This file is meant | |
purely as an educational tool and is in no way optimized. The goals are to | |
1. illustrate how bits-back coding can be used with Huffman-like codecs; | |
2. and how the cost of using a selector to toggle between codebooks can be greatly reduced. | |
- Symbols are integers between 0 and 2; |