tag: python

Python setup on Ubuntu 16.04

Sep 21, 2016

In this post I will document my approach to python on Ubuntu 16.04. To be clear, this is not the only way to do things and I make no claims that it is the best strategy. However, it is useful for me to write this information down for future reference. Who knows, it might be helpful for you too!? Let me know if it is. I also love to read about other approaches, so leave comments and/or links below.

Installing Fiona on Ubuntu 14.04

Aug 20, 2015

This post consists of some quick notes on installing Fiona, a Python interface to OGR, which is a tool that one might want if working with GIS data on a regular basis. I'm trying to do things like convert shapefiles to geojson-- without much luck until now (see below)-- and this is one of the tools I'm looking at as part of the solution. If you want to install Fiona on Ubuntu 14.04 follow along.

Decision trees in python again, cross-validation

Jun 25, 2015

This is my second post on decision trees using scikit-learn and Python. The first post focused on visualizing the resulting tree. This post will concentrate on using cross-validation methods to choose the parameters used to train the tree. In particular, I'll focus on grid and random search for decision tree parameter settings. If this sounds interesting to you, following along. As always, comments, questions and corrections are welcome below.

PySoundFile and Python 3.4 on Ubuntu 14.04

Jun 16, 2015

In a previous post I went over installing PySoundFile on Ubuntu 14.04 using the default version of Python-- that's version 2.7.6. In this post I'll cover the use of Python 3.4 in a virtual environment-- the goal here, at least in the long run, is to write audio processing (dsp) code in Python that is version 2- and 3-compatible.

Decision trees in python with scikit-learn and pandas

Jun 8, 2015

In this post I will cover decision trees (for classification) in python, using scikit-learn and pandas. The emphasis will be on the basics and understanding the resulting decision tree.

Revisiting the medical tests example with Python and Lea

May 27, 2015

In this post I will use Python, and the probabilistic programming package Lea, to re-analyze an example of Bayes' Theorem covered in an earlier post. The focus will be on translating the by-hand calculations into Python code.

Installing PySoundFile on Ubuntu 14.04

Mar 3, 2015

In this post I will go over installing PySoundFile using pip and virtualenvwrapper. PySoundFile is a utility for reading and writing sound files of various types, like wav, flac, and ogg using the abilities of the libsndfile library. Noticeably absent is mp3 due to the license issue-- use a tool like (the wonderful) sox to convert mp3's to a supported file type.

Inferring probabilities with a Beta prior, a third example of Bayesian calculations

Dec 11, 2014

In this post I will expand on a previous example of inferring probabilities from a data series. In particular, instead of considering a discrete set of candidate probabilities, I'll consider all (continuous) values between \( 0 \) and \( 1 \). This means our prior (and posterior) will now be a probability density function (pdf) instead of a probabilty mass function (pmf). More specifically, I'll use the Beta Distribution for this example.

Installing essentia for audio feature extraction

Dec 10, 2014

Some notes on the installation of essentia, a collection of c++ code with Python wrappers for audio feature extraction, following the essentia installation guide.

Getting started with Latent Dirichlet Allocation in Python

Nov 13, 2014

In this post I will go over installation and basic usage of the lda Python package for Latent Dirichlet Allocation (LDA). I will not go through the theoretical foundations of the method in this post. However, the main reference for this model, Blei et. al. (2003) is freely available online and I think the main idea of assigning documents in a corpus (set of documents) to latent (hidden) topics based on a vector of words is fairly simple to understand and the example will help to solidify our understanding of the LDA model.

Inferring probabilities, a second example of Bayesian calculations

Oct 24, 2014

In this post I will focus on an example of inferring probabilities given a short data series. I will start by tackling the theory of how to do the desired inference in a Bayesian way and will end by implementing the theory in Python so that we can play around with the ideas. In an attempt to keep the post more accessible, I will only consider a small set of candidate probabilities. This restriction allows me to minimize the mathematical difficulty of the inference and still obtain really cool results, including nice plots of the prior, likelihood and posterior.

Python 3.4 on Ubuntu 14.04 using virtual environments

Sep 16, 2014

In a previous post I talked about using virtual environments with the default Python version-- this is Python 2.7.6 for Ubuntu 14.04. However, both Python 2.7 and 3.4 are available on Ubuntu 14.04. In this post I'll go over setting up a virtual environment for working with Python 3 code.

virtualenv and virtualenvwrapper on Ubuntu 14.04

Sep 4, 2014

In this post I'll go over my attempt to setup virtual environments for Python development. Most Python users probably don't want to use virtual environments and should just set up a single user environment that works for their needs. However, if you are working on writing one or more Python modules or packages, these tools are geared towards creating isolated Python environments for each project. This is very useful for keeping track of such things as the minimal Python requirements for each project.

Install Python packages on Ubuntu 14.04

Jun 4, 2014

In this post I will document my setup of Python 2.7.6 in Ubuntu 14.04. Of course, the base Python is installed by default, but both Python 2.7.6 and Python 3.4 are available.