| hanaml.LinearRegression {hana.ml.r} | R Documentation |
hanaml.LinearRegression is a R wrapper for PAL linear regression algorithm.
hanaml.LinearRegression(conn.context, data = NULL, key = NULL, features = NULL,
label = NULL, formula = NULL, solver = NULL, var.select = NULL,
intercept = NULL, alpha.to.enter = NULL, alpha.to.remove = NULL,
enet.lambda = NULL, enet.alpha = NULL, max.iter = NULL,
tol = NULL, pho = NULL, stat.inf = NULL, adjusted.r2 = NULL,
dw.test = NULL, reset.test = NULL, bp.test = NULL,
ks.test = NULL, thread.ratio = NULL, categorical.variable = NULL,
pmml.export = NULL)
conn.context |
|
data |
|
key |
|
features |
|
label |
|
formula |
|
solver |
Defaults to "QR". |
var.select |
'forward' and 'backward' selection are supported only when solver
is 'QR', 'SVD' or 'Cholesky'. |
intercept |
|
alpha.to.enter |
|
alpha.to.remove |
|
enet.lambda |
|
enet.alpha |
|
max.iter |
|
tol |
|
pho |
|
stat.inf |
|
adjusted.r2 |
|
dw.test |
|
reset.test |
|
bp.test |
|
ks.test |
|
thread.ratio |
|
categorical.variable |
|
pmml.export |
Defaults to 'no'. |
R6Class object.
Linear regression is an approach to model the linear relationship and one or more variables, usually referred to as independent variables, denoted as predictor vector.
Return a "LinearRegression" object with following values:
coefficients : DataFrame
Fitted regression coefficients.
pmml : DataFrame
PMML model. Set to None if no PMML model was requested.
fitted : DataFrame
Predicted dependent variable values for training data.
Set to None if the training data has no row IDs.
statistics : DataFrame
Regression-related statistics, such as mean squared error.
## Not run:
Input DataFrame df for training:
> df$Collect()
ID Y X1 X2 X3
0 0 -6.879 0.00 A 1
1 1 -3.449 0.50 A 1
2 2 6.635 0.54 B 1
3 3 11.844 1.04 B 1
4 4 2.786 1.50 A 1
5 5 2.389 0.04 B 2
6 6 -0.011 2.00 A 2
7 7 8.839 2.04 B 2
8 8 4.689 1.54 B 1
9 9 -5.507 1.00 A 2
Model traning and a "LinearRegression" object lr is returned:
>lr <- LinearRegression(conn.context = conn, data = df, key = "ID",
label = "Y", thread.ratio = 0.5,
categorical.variable = list("X3"))
Output:
> lr$coefficients
COEFFICIENT COEFFICIENT VALUE
1 \__PAL_INTERCEPT__ -5.7045
2 X1 3.0925
3 X2__PAL_DELIMIT__A 0.0000
4 X2__PAL_DELIMIT__B 9.3675
5 X3__PAL_DELIMIT__1 0.0000
lr$s6 X3__PAL_DELIMIT__2 -2.6895
7 \__PAL_INTERCEPT__ -5.7045
8 X1 3.0925
9 X2__PAL_DELIMIT__A 0.0000
10 X2__PAL_DELIMIT__B 9.3675
11 X3__PAL_DELIMIT__1 0.0000
12 X3__PAL_DELIMIT__2 -2.6895
## End(Not run)