One of the cool things about the rbspy profiler is that it can profile any running Ruby program, without even pausing the Ruby program that is being profiled. Rbspy is a sampling profiler, and when the --nonblocking argument is passed to it, it will collect each stack trace from the profiled program without pausing it or doing any synchronization. This has the advantage of not slowing down the…
One of the cool new features in py-spy is the ability to profile native Python extensions written in languages like C, C++ or Cython. Almost all other Python profilers [1] only show program activity that is in pure Python code, and native code will instead show up as spending time in the line of Python that calls the native function. Using native profiling tools like perf can get you a sense of…
I’ve been writing some code in Rust recently, and I thought it would be cool if I could take some of this Rust code and provide it as a native extension that I can call from Python. It turns out there are some amazing tools like PyO3 that make it easy to write fully featured Python extensions in Rust, with considerably less effort than writing a CPython extension manually. To test out PyO3 I wrote…
I’ve been digging into GitHub data recently, and I thought it would be fun to use that data to figure out exactly where the world’s software developers live and then to visualize the results interactively using D3. In a previous post, I wrote about how an individual’s GitHub profile is a noisy and unreliable indicator of programming talent . For this post though I’m aggregating GitHub profiles…
I’m working on a larger generative art project, and one thing that I need for this is an abstract representation of something that could conceivably be eaten by an ant. While ants will apparently eat almost anything, I decided to use flowers to represent their food since pictures of decomposing fruit didn’t end up looking all that appealing. This post is a quick tutorial on how I generated these…
One of the things I’m working on right now is a project that’s aggregating data found in developers GitHub profiles. Since there are a couple of problems with using GitHub profiles as a data source like this, I wanted to first list out some of the issues I have with trying to assess developers by looking only at their GitHub contributions. One common misuse of GitHub profile data is in trying to…
I’ve recently become obsessed with the sheer amount of development activity happening on sites like GitHub. As a first project on working with this data, I thought it would be fun to rank all the programming languages by counting how many people on GitHub use each language. I’m using the GitHub Archive and GHTorrent projects as data sources for this analysis. The GitHub Archive provides a record…
I recently bought a system that actually has a decent GPU on it, and I thought it would be cool to learn a little bit about CUDA programming to really take advantage of it. The obvious choice of problems to get started with was extending my implicit matrix factorization code to run on the GPU. I’ve written a couple of posts about this recommendation algorithm already, but the task is basically to…
A site’s robots.txt file advises the web crawlers of the worlds what files they can and can’t download. It acts as the first gatekeeper of the internet, unlike blocking the response - it lets you stop requests to your site before it happens. The interesting thing about these files is that it lays out how webmasters intend automated processes should access their websites. While it’s easy for a bot…
One challenge that recommender systems face is in quickly generating a list of the best recommendations to show for the user. These days many libraries can quickly train models that can handle millions of users and millions of items, but the naive solution for evaluating these models involves ranking every single item for every single user which can be extremely expensive. As an example, my…
If you look at the programming languages benchmarks game, Python is one of the slowest commonly used programming languages out there . Typical programs written in pure Python average around 40 times slower than the equivalent program written in C or C++. Despite the performance penalty, Python is still probably the most popular language choice out there for doing Data Analysis and Machine…
As part of my post on matrix factorization , I released a fast Python version of the Implicit Alternating Least Squares matrix factorization algorithm that is frequently used to recommend items. While this matrix factorization code was already extremely fast , it still wasn’t implementing the fastest algorithm I know about for doing this matrix factorization. This post is just a quick follow up,…
Numerical Optimization is one of the central techniques in Machine Learning. For many problems it is hard to figure out the best solution directly, but it is relatively easy to set up a loss function that measures how good a solution is - and then minimize the parameters of that function to find the solution. I ended up writing a bunch of numerical optimization routines back when I was first…
In a previous post I wrote about how to build a ‘People Who Like This Also Like …’ feature for displaying lists of similar musicians. My goal was to show how simple Information Retrieval techniques can do a good job calculating lists of related artists. For instance, using BM25 distance on The Beatles shows the most similar artists being John Lennon and Paul McCartney. One interesting technique I…
A while ago I wrote a small library for displaying Venn and Euler diagrams when trying to learn Javascript. By specifying the sizes of each area in the diagram, the library automatically draws a Venn or Euler diagram such that areas displayed have sizes that approximately match the input. Sample output of this library, from this tumblr It turned out that displaying the circles is trivial - but…
U+1F4A9 'Pile Of Poo' Unicode is one of the greatest standards of the modern age, but its simple appearance hides an insane level of complexity. Unicode aims to represent every possible character in every possible language in a single character encoding. It’s an ambitious undertaking, the current version has mapped 113 thousand distinct characters to code points in Unicode - each one of which is…
A while ago a friend of mine asked me how I would go about building a ‘People Who Like This Also Like …’ feature for a music startup he was working at. For each band or musician, he wanted to display a list of other artists that people might also be interested in. At the time, I think I arrogantly responded with something like “That’s easy! I can think of like a dozen ways of calculating this!”.…
Pretty much every Python programmer out there has broken down at one point and and used the ‘ pickle ’ module for writing objects out to disk. The advantage of using pickle is that it can serialize pretty much any Python object, without having to add any extra code. Its also smart in that in will only write out any single object once, making it effective to store recursive structures like graphs.…
While attempting to learn Javascript and D3.js a couple months ago, I wrote a little library for displaying area proportional venn diagrams . One thing this library didn’t do though is consider the intersection areas of 3 or more circles when placing each set in the venn diagram. Its a trickier problem than I first thought, mainly because of all the special cases that can arise when the number of…
I haven’t done any real work on learning Javascript and D3.js since my last attempt a couple months back. To keep at it, I thought I’d try using D3.js to visualize a simple algorithm: finding the largest couple of items in a list. This problem comes up all the time when doing search and recommendation type tasks. Every time you query a search engine, it has to find the couple best scored results…