gradient_descent_1: Gradient descent function for OLS regression

Description Usage Arguments Value Examples

View source: R/gradient_descent.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_1(
  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 ~., iris, alpha=0.01, contrasts = NULL, tolerance=1e-10)

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