out_gradient_descent: out-of-sample gradient descent

Description Usage Arguments Examples

View source: R/function.R

Description

implementation of gradient descent for ordinary least squares, finding the solutions for Y = X*beta and choose the best best beta that gives best out of sample accuracy

Usage

1
2
out_gradient_descent(formula, data, lambda = 1e-04, N = 5e+05,
  M = 10)

Arguments

formula

a formula for ridge regression

data

the data you want to regress on

lambda

learning rate

N

number of iterations

M

number of folds to split the dataset

Examples

1
2
3
4
5
6
set.seed(100)
ogd = data.frame(red = runif(100,0,1), yellow = runif(100,0,1),blue=runif(100,0,1))
ogd$price = 0.2*ogd$red + (0.4*(ogd$yellow **2)) + 0.5 * ogd$blue
formula = price ~ .
data = ogd
out_gradient_descent(formula, data)

importbq/bis557 documentation built on Dec. 21, 2020, 3:05 a.m.