gradient_descent: gradient_descent

Description Usage Arguments Value Examples

View source: R/gradient_descent.R

Description

Compute a linear regression with gradient descent method.

Usage

1
2
3
4
5
6
7
8
gradient_descent(
  form,
  dat,
  contrasts = NULL,
  factor = 1e-04,
  m.iteration = 1e+05,
  b.difference = 1e-10
)

Arguments

form

A formula with the format of "Y ~ .".

dat

A dataframe.

contrasts

A list of contrasts.

factor

The factor to adjust beta, set default as 0.0001.

m.iteration

The maximum iteration times to allow the loop to exit, set default as 1e5

b.difference

The difference between previous sum of residuals and new sum of residuals to allow the loop to exit, set default as 1e-10.

Value

A list of coefficients from an linear regression model with gradient descent.

Examples

1
2
3
4
## Not run: 
gradient_descent(Sepal.Length ~ ., iris, contrasts)

## End(Not run)

Z1chenZhao/bis557 documentation built on Dec. 21, 2020, 10:03 p.m.