How to run scripts in the background

Jessica YungProgramming

When running machine learning experiments, you might want to run multiple scripts simultaneously, hide printouts for a script or just do things in a terminal window while running a Jupyter Notebook in the background. In this post, we will go through how to run scripts in the background, bring them back to the foreground, and check if the scripts are … Read More

How Python implements dictionaries

Jessica YungProgramming

Python Dictionaries: Not even a space-time tradeoff If you could choose to store things that you’d want to look up later in a Python dictionary or in a Python list, which would you choose? It turns out that looking up items in a Python dictionary is much faster than looking up items in a Python list. If you search for … Read More

Numpy Views vs Copies: Avoiding Costly Mistakes

Jessica YungData Science, Programming

In this post we will talk about the differences between views and copies. It’s really important you’re aware of the difference between the two. Otherwise you might run into problems like accidentally modifying arrays. What are views and copies? With a view, it’s like you are viewing the original (base) array. The view is actually part of the original array even though … Read More

What makes Numpy Arrays Fast: Memory and Strides

Jessica YungMachine Learning, Programming

How is Numpy so fast? In this post we find out how Numpy’s ndarray is stored and how it is usually manipulated by Numpy functions using strides. Getting to know the ndarray A NumPy ndarray is a N-dimensional array. You can create one like this:

These arrays are homogenous arrays of fixed-sized items. That is, all the items in … Read More

Python Lists vs Dictionaries: The space-time tradeoff

Jessica YungProgramming, Python

If you had to write a script to check whether a person had registered for an event, what Python data structure would you use? It turns out that looking up items in a Python dictionary is much faster than looking up items in a Python list. How much faster? Suppose you want to check if 1000 items (needles) are in … Read More

How to use pickle to save and load variables in Python

Jessica YungData Science, Programming

pickle is a module used to convert Python objects to a character stream. You can (1) use it to save the state of a program so you can continue running it later. You can also (2) transmit the (secured) pickled data over a network. The latter is important for parallel and distributed computing. How to save variables to a .pickle file: … Read More

How to Tackle Programming Problems (Google Code Jam 2017 Qualification Round, Problem A)

Jessica YungProgramming, Uncategorized

This is a walkthrough of how one might start thinking about Problem A (small input) of Google Code Jam’s 2017 Qualification Round (April 8-9). Google posts excellent solutions to their problems, so the focus here will be that of the idea generation process or how one might begin to tackle such problems. Full problem statements can be found here. Problem A (Oversized … Read More

Bugger! 4.2: Semicircle lane lines

Jessica YungProgramming, Self-Driving Car ND

Recap from the previous post: we’re trying to trace lane lines from a video. We just dealt with our pipeline spitting out zebra stripes, but now we’ve got a semicircle trace to deal with (see feature image above). What to do? Step 1: Plot intermediate steps to locate the bug Recall that our model is supposed to: Un-distort the test image … Read More