Wednesday, August 27, 2014

Clustering vs. Linear Regression - which to use?

I've got some data and I'm trying to make an informed decision whether it is better described by a linear regression or a set of clusters.

My goal here is to compare linear regression and clustering for some cases that are obviously better for one of these or the other, using 2-dimensional data that is easy to visualize.  By comparing these two workhorse methods under these conditions I'm hoping to gain better understanding of each and of how to decide when to use one or the other.

The 3 data sets I used were:
  1. "obviously" better described by linear regression
  2. "obviously" better described by clustering
  3. in between the above 2 extremes
I used R.  The scripts I used are present in this repository:
https://github.com/dllahr/cluster_vs_linear_regression

I got the code for clustering from:
http://www.statmethods.net/advstats/cluster.html

Before we get started:  my friend Phil Montgomery who kindly reviewed this post made a good suggestion that in general, when you have 2 models and you are trying to decide which one to use, you want to compare the statistical likelihood of each.  Usually this is done by comparing different values of parameters for a mathematical model, but it is worth investigating if it has been done for comparison of these two systems.

Sunday, August 10, 2014

Raspberry Pi RAID array

I largely followed these very helpful instructions:
http://www.davidhunt.ie/raid-pi-raspberry-pi-as-a-raid-file-server/

also useful:
http://ubuntuforums.org/showthread.php?t=408461
http://en.wikipedia.org/wiki/RAID
http://en.wikipedia.org/wiki/Mdadm

ingredients
  • 2 1-TB western digital drives
    • USB hub with power supply for these
      • Edit: make sure it has enough power to power the drives! My initial one (pictured below) did not and I suspect it was drawing power from the pi causing it to crash
  • raspberry pi
    • USB power supply for this (separate from above)
  • 8 GB sandisk microSD card
    • for use in raspberry pi
    • microSD card reader
  • cables to connect all

Saturday, June 28, 2014

Matlab solar system trajectory simulation

I wrote some code to simulate the trajectory of an object through a grossly simplified version of the solar system.  It uses the ordinary differential equation solver that comes with Matlab, some Newtonian physics, only has the Sun, Earth and Moon, and only uses idealized, circular orbits for those.  The code is here in this github repository:
https://github.com/dllahr/Matlab_solar_trajectory_sim

It's kind of fun to play with and someday I'd like to make an interactive web browser version of it, using perhaps this javascript library for numerical calculations:
http://numericjs.com/

Update - important note:  I have subsequently learned about the problem of energy drift which is when using basic differential equation solvers on even simple Newtonian systems, the result will have the system's energy increasing over time - sometimes even exponentially!  There are another class of differential equation solvers (Verlet Integration, Sympletic Integrator) that address this problem, the solar system trajectory code above should be updated to use these instead.

Tuesday, May 6, 2014

Peanut butter porter - the bottling

I bottled the peanut butter porter today, I used ~5/8 cup of dry malt extract for the sugar, boiled in water ~5 minutes, added to the beer as I was transferring from the carboy to the bottling bucket.  The material left over in the carboy was an oily mess, and based on that and what I tasted, I'm hopeful that most / all of the oil was left behind and the beer in the bottles is not oily.  However, I tasted it and it didn't really taste like peanut butter!

Monday, April 28, 2014

Video about BARD

My co-workers made a video about the BARD project, it is short but a great explanation of why BARD is needed and what it does.  Please consider checking it out and if you like, lick the thumbs up button:
https://www.youtube.com/watch?v=j9Z00y6g1iQ

Sunday, April 6, 2014

Carob Porter - the conclusion

Had a bottle of the Carob Porter on 2014-03-02 - at room temperature - tasted pretty good.  Bottom of bottle was covered in sediment, but the poor into the glass was not cloudy.  It is a very dark beer.

I continued to drink it on an almost daily basis and found it quite enjoyable.