Skip to content

Instantly share code, notes, and snippets.

View Tom-Alexander's full-sized avatar

Tom Alexander Tom-Alexander

View GitHub Profile
@Tom-Alexander
Tom-Alexander / npm_cygwin
Created March 6, 2014 06:59
NPM in Cygwin
echo "alias npm='cmd /c npm'" >> ~/.bashrc
@Tom-Alexander
Tom-Alexander / weightedLinearRegression
Created October 26, 2013 08:05
Weighted Linear Regression
function weightedLinearRegression(data, weights){
var sums = {xw: 0, x: 0, yw: 0, y: 0, a: 0, b: 0};
// compute the weighted averages
for(var i = 0; i < data.length; i++){
sums.xw += data[i][0] * weights[i];
sums.yw += data[i][1] * weights[i];
sums.x += data[i][0];