View source: R/gradient_descent.R

gradient_descent | R Documentation |

This is a function taking a formula, a dataframe and an optional list of contrast for factor variables, and using gradient descent to return to coefficients. with reference to https://towardsdatascience.com/linear-regression-using-gradient-descent-97a6c8700931

```
gradient_descent(formula, df, contrasts = NULL, gamma = 1e-04, iter = 10^5)
```

`formula` |
an object of class "formula": describing the model to be fitted. |

`df` |
a dataframe that containing all the variables in the model. |

`contrasts` |
an optional list of contrasts for factor variables. |

`gamma` |
gamma_k, the learning rate |

`iter` |
number of iterations |

```
data(iris)
form <- Sepal.Length ~ Sepal.Width
gradient_descent(formula = form,df = iris)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.