Monday, July 30, 2012

Non-negative Matrix Factorization

I found some Python code for Non-negative Matrix Factorization. I've altered it to run more like the NMF code in Programming Collective Intelligence. Since the factorization depends on two random matrices, it might be best to factorize several times, and then cluster a set of H matrices using Affinity Propagation, or K-Means.

Tuesday, July 24, 2012

One-Liner for Finding Peaks or Troughs in Data

To find the indices of the peaks or troughs in a data set x, using Python of MATLAB, we use
pks = find( diff( sign( diff( x ) ) ) < 0 ) + 1
trs = find( diff( sign( diff( x ) ) ) > 0 ) + 1 
 

Sunday, July 8, 2012

Arduino and Processing

Arduino is a type of microcontroller. It is also the name of the programming language used for said microcontroller. Processing is a verb and a programming language for use along with Arduinos running an Arduino sketch. Confusing? Both Arduino and Processing programs are called sketches, and have a .pde suffix. Generally, we'll have an Arduino sketch running on the Arguing device, while a Processing sketch is running on the computer. Whew.

Friday, July 6, 2012

Exercise 2.4 from the Arduino Cookbook

I used two push-button switches with four prongs. It only worked when the prongs were attached diagonally.