Skip to content

Instantly share code, notes, and snippets.

View r-barnes's full-sized avatar

Richard Barnes r-barnes

View GitHub Profile
@smc77
smc77 / logistic_gradient_descent.R
Created October 28, 2011 03:14
Logistic Regression with Gradient Descent
num.iterations <- 1000
# Download South African heart disease data
sa.heart <- read.table("http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/SAheart.data", sep=",",head=T,row.names=1)
x <- sa.heart[,c("age", "ldl")]
y <- sa.heart$chd
plot(x, pch=21, bg=c("red","green")[factor(y)])
# Function to standardize input values