Category: python

  • Fast optimization of classification thresholds

    Binary classification problems (target/non-target) are often modeled as a pair where is our model, which maps input vectors to scores, and is our threshold, such that we predict to be of target class iff . Otherwise, we predict it to be of non-target class. The threshold is usually set to , but this needs not…

  • Storing a list in an int

    Python’s default ints, unlike in C, Rust or Go, are of arbitrary size.1,2 What that means is there’s no absolute maximum value your ints can store. They’ll grow as long as they fit in memory. For example, you can open python3 and run the following. So a normal, every-day int in python can easily store…

  • Add __init__.py files if using pkg_resources

    If you’re working on a python package, and you’re using setuptools‘s pkg_resources for handling data files in your package, then you should add __init__.py files to all your internal sub-directories. In fact, just make your life easier and always add __init__.py packages everywhere as if you were using python2, because not having them also creates…

Create a website or blog at WordPress.com