How to Serve a Web App With NGINX, uWSGI and Flask. And Why You'd Want to.

So, you want to serve your Python app on the web? And you’re not sure how to? You know, you remind me a lot of myself. Seems like just yesterday that I was in your shoes.

And that’s because I was. Yesterday I had to patch and re-deploy a Flask app I’d thrown together a few years back. Patching was fine, but when it came around to re-deploying, I realized that I had no idea what I was doing - I’d originally deployed it by hastily copying and pasting code snippets from tutorials and Stack Overflow. But I hadn’t actually learned anything in the process.

So I went and did some research. My goal was to get a high level understanding of each component and its purpose. I’m glad I did - having a basic understanding of the network architecture behind my app made

Time Series Forecasting With Autoregression

Forecasting (predicting future values) with time series can be tricky. This is because time series data may exhibit behavior that violates the assumptions of many modeling methods. Because of this, are a few special considerations you need to make when working with time series data. This post will serve as an introduction to and reference for some of the behaviors you should look for when modeling time series data with autoregression.

Why We Need To Be Careful

First, we should note that time series behavior is of particular concern for parametric models (models for which we make an assumption about the functional form of the process that generates the series). For non-parametric models (models where we don't make assumptions about the form of our series' generative process, such as neural networks and tree based methods), we may not need to worry about time's effect on our model parameters.

We'll be

An Intro to Named Entity Recognition Using Hidden Markov Models

A few weeks ago, I was asked to create an Named Entity Recognition (NER) model as part of a take home assesment. Though I haven't gotten the job (yet), I really enjoyed working on the problem. And I'd love to share my work with you.

*Please note that the company has graciously assured me that the work I did was my own. I used an open source dataset and open source libraries, and I am not disclosing any confidential information.

Let's break this post down into 6 parts:

  1. The Problem
  2. The Data
  3. Markov Processes
  4. The Hidden Markov Model (HMM)
  5. Feature Engineering
  6. Model Selection
  7. Analysis & Conclusions

The Problem

Named Entity Recognition is a particularly interesting NLP task. A subtask of information extraction, it comprises identifying named entities - objects that may have names, such as people, places, organizations - in text documents.

There a number of ways to define and

Feature-Based Sentiment Analysis: An Introduction

The goal of this post is to provide a high level introduction to the core concepts of Sentiment Analysis. We'll define the Sentiment Analysis task, discuss the concepts of subjectivity and objectivity, and breifly discuss how Sentiment Analysis can be applied to extract specific feature-opinion pairs from text.

The Sentiment Analysis Task

What exactly is Sentiment Analysis? It's the classification and extraction of sentiment - opinions and their associated emotions - from text.

An opinion is a sentiment expressed on a specific entity, such as a product, person, organization, or location. It's expressed by an entity, and an entity that expresses an opinion is an opinion holder.

We use the term object to refer to the target entity of an opinion. An object may consist of a set of components and attributes, which we refer to as features. Opinions may also be expressed on features, and a feature may consist

Tutorial: Create Your Own Package With Homebrew and Python

A few weeks ago, I wrote a script to manage AWS EC2 spot instances. It was the most complex BASH script I'd ever written. I was proud, and while riding that pride on my wave of success I confidently decided to extend my script into a full-blown package I could share with the world.

Two weeks and an uncountable number of hours later, I've succeeded. But I now recognize that my confidence was borderline arrogance. It turns out that turning your project into a package isn't hard - you really just need to create an extra file or two. However, learning WHAT those files should contain, WHERE your project files will be installed to, and the WHY behnd those two items is extremely difficult. I couldn't find a single resource that covered all of those items.

So I've created one. This tutorial is intended for people who've never created a