gradient_descent_new: Gradient descent based on the out-of-sample accuracy.

Description Usage Arguments Value Examples

View source: R/gradient_descent_new.R

Description

This is a function to fit the OLS model using gradient descent that calculates the penalty based on the out-of-sample accuracy.

Usage

1
2
3
4
5
6
7
8
gradient_descent_new(
  formula,
  data_frame,
  contrasts = NULL,
  lambda = 1e-04,
  epsilon = 1e-20,
  iters = 1e+06
)

Arguments

formula

The formula of the model to be fitted.

data_frame

A data frame which contains the data for the model.

contrasts

Default is NULL. A list of contrasts for factor variables.

lambda

Default is 0.0001. The learning rate.

epsilon

Default is 1e-20. The minimum difference between the current SSR and the updated SSR.

iters

Default is 1e6. The maximum number of iterations.

Value

A list of estimated coefficients.

Examples

1
2
3
data(iris)
model <- gradient_descent_new(Sepal.Length ~ ., data = iris)
model$coefficients

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