Posts

  • Python dictionary get with default value

    Yesterday I spent way more time than neccessary debugging a piece of python code. It has something to do with how the python dictionary’s get method works with default arguments. TLDR: it is ok when default is a simple value, not recommended...
  • Python sequentially unpacks tuple with assignment expression

    The other day, I shadowed an interview with a data science candidate. The primary focus is obviously not on coding skills, but we do want to assess basic knowledge of the programming language of his choice. So, my colleague asked a very...
  • Learning to rank

    Notes on Learning To Rank Task We want to learn a function \(f(q, D)\) which takes in a query \(q\) and a list of documents \(D=\{d_1, d_2, ..., d_n\}\), and produces scores using which we can rank/order the list of documents. Types...
  • Just when you think you know shake up enough

    Yester day I experienced my biggest shakeup ever since I started participating on Kaggle. I dropped from silver zone to nowhere. The competition is an image segmentation competition, and based on past experience, CV competitions has relatively low shakeups(compare to tabular/transaction/time series...
  • Iterate over an iterable multiple times

    I was working on a piece of code today and I need to iterate over a iterable multiple times to do some computes. The body of code is the same for all passes. One obvious thing I can do is to do...
  • Clean python code to get a reverse mapping

    When working with machine learning problems, often I use python dictionary to map categorical values to its integer encoded values. Something like: import string feature_encoder = {v:i for i, v in enumerate(string.ascii_lowercase)} To get back the original value, I need to have...
  • Hello Jekyll on Github Pages

    My current website hosting costs me $7.99 a month plus ~$20 for domain name per year. I have been paying this amount for a little more than 3 years, and finally decided to cut the hosting fee by migrating over to github...