Last active
November 27, 2017 21:38
-
-
Save conormm/c1cb44db0e44fd8a8c9f4dd88d2edd79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
n <- 200 # number of observations | |
bias <- 4 | |
slope <- 3.5 | |
dot <- `%*%` # defined for personal preference | |
x <- rnorm(n) * 2 | |
x_b <- cbind(x, rep(1, n)) | |
y <- bias + slope * x + rnorm(n) | |
df <- data_frame(x = x, y = y) | |
learning_rate <- 0.05 | |
n_iterations <- 100 | |
theta <- matrix(c(20, 20)) | |
b0 <- vector("numeric", length = n_iterations) | |
b1 <- vector("numeric", length = n_iterations) | |
sse_i <- vector("numeric", length = n_iterations) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment