gradient_descent: Gradient descent function for OLS regression with the penalty...

Description Usage Arguments Value Examples

View source: R/gradient_descent_out_samp_accurancy.R

Description

Gradient descent is a optimization algorithm which is often used to find the minimum of a function

Usage

1
2
3
4
5
6
7
gradient_descent(
  formula,
  data,
  contrasts = NULL,
  alpha = 1e-04,
  tolerance = 1e-20
)

Arguments

formula

Formula of the regression model

data

The data used for gradient descent

contrasts

A list of contrasts for factor variables.

alpha

Learning rate

tolerance

The threshold of iterations

Value

The estimated coefficients for OLS regression.

Examples

1
2
data(iris)
gradient_descent(Sepal.Length ~Petal.Width, iris, alpha=0.01, contrasts = NULL, tolerance=1e-10)

wuyinfeistella/bis557 documentation built on Jan. 1, 2021, 12:52 p.m.