osm_gradient_descent: out-of-sample gradient descent

Description Usage Arguments Value Examples

View source: R/osm_gradient_descent.R

Description

Implement gradient descent for ordinary least squares

Usage

1
2
3
4
5
6
7
8
9
osm_gradient_descent(
  form,
  dat,
  contrasts = NULL,
  factor = 1e-04,
  m.iteration = 1e+05,
  b.difference = 1e-10,
  F = 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.

F

The number of folds, set default as 10

Value

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

Examples

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

## End(Not run)

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