Description Usage Arguments Value Examples
View source: R/new-gradient-descent.R
This is a function fitting the OLS model using gradient descent which calculate the loss based on the out-of-sample accuracy.
1 2 | new_gradient_descent(form, data, gamma = 1e-04, beta0 = 1,
fold.num = 10, stop.diff = 1e-08, max.itera = 5e+05)
|
form |
a formula with the legal format. |
data |
a dataframe provided by the user. |
gamma |
a factor defined by user as a pace or speed of gradient descent (default=0.0001). |
beta0 |
an initializer for the beta vector that can be changed by user (default=1). |
fold.num |
a fold number of k-fold cv. |
stop.diff |
an absolute difference between loss and the updated one set by user to stop the iteration at some satisfying point (default=1e-8). |
max.itera |
a maximum number of iterations set by user, which is an alternative criterion to stop the iterations (default=1e6). |
a list including the coefficient estimates.
1 2 3 | data(iris)
fit <- new_gradient_descent(Sepal.Length ~ ., iris)
fit$coefficients
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.