Description Usage Arguments Examples
View source: R/my-grad-descent.r
This is a simple algorithm to solve a linear regression model.
1 2 3 4 5 6 7 8 9 | my_grad_descent(
form,
data,
contrasts = NULL,
lambda = 1e-04,
tolerence = 1e-15,
beta_ini = 1,
max_itr = 1e+06
)
|
form |
a formula object, e.g. y ~ x1 + x2 |
data |
a data frame |
contrasts |
a list, whose entries are values (numeric matrices, functions
or character strings naming functions) to be used as replacement values for
the contrasts replacement function and whose names are the names of columns
of data containing factors. If |
lambda |
a numeric number indicating the learning rate for gradient descent algorithm |
tolerence |
a numeric number indicating the precision of the algorithm |
beta_ini |
a numeric number indicating the initial value for beta coeffficient |
max_itr |
an integer indicating the maximum number iterations |
1 2 3 | data(iris)
fit <- my_grad_descent(Sepal.Length ~ ., data = iris)
fit$coefficients
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.