hanaml.MLPClassifier.Rdhanaml.MLPClassifier is a R wrapper for SAP HANA PAL Multi-layer Perceptron algorithm for classification.
hanaml.MLPClassifier( data = NULL, key = NULL, features = NULL, label = NULL, formula = NULL, hidden.layer.size = NULL, activation = NULL, output.activation = NULL, learning.rate = NULL, momentum = NULL, training.style = NULL, max.iter = NULL, normalization = NULL, weight.init = NULL, thread.ratio = NULL, categorical.variable = NULL, batch.size = NULL, resampling.method = NULL, evaluation.metric = NULL, fold.num = NULL, repeat.times = NULL, param.search.strategy = NULL, random.search.times = NULL, random.state = NULL, timeout = NULL, progress.indicator.id = NULL, parameter.range = NULL, parameter.values = NULL )
| data |
|
|---|---|
| key |
|
| features |
|
| label |
|
| formula |
|
| hidden.layer.size |
|
| activation |
|
| output.activation |
|
| learning.rate |
|
| momentum |
|
| training.style |
|
| max.iter |
|
| normalization |
|
| weight.init |
|
| thread.ratio |
|
| categorical.variable |
|
| batch.size |
|
| resampling.method |
|
| evaluation.metric |
|
| fold.num |
|
| repeat.times |
|
| param.search.strategy |
|
| random.search.times |
|
| random.state |
|
| timeout |
|
| progress.indicator.id |
|
| parameter.range |
|
| parameter.values |
|
A "MLPClassifier" object with the following attributes:
model: DataFrame
ROW_INDEX - model row index.
MODEL_CONTENT - model content.
log: DataFrame
ITERATION - iteration number.
ERROR - Mean squared error between predicted values
and target values for each iteration.
statistics: DataFrame
STAT_NAME - statistics name.
STAT_VALUE - values of the statistics.
optim.param: DataFrame
Selected optimal parameters.
Input DataFrame data:
> data$Collect() V000 V001 V002 V003 LABEL 1 1 1.71 AC 0 AA 2 10 1.78 CA 5 AB 3 17 2.36 AA 6 AA 4 12 3.15 AA 2 C 5 7 1.05 CA 3 AB 6 6 1.50 CA 2 AB 7 9 1.97 CA 6 C 8 5 1.26 AA 1 AA 9 12 2.13 AC 4 C 10 18 1.87 AC 6 AA
Training the model:
> mlpc <- hanaml.MLPClassifier(data = data,
hidden.layer.size = c(10,10),
activation = "TANH",
output.activation ="TANH",
learning.rate = 0.001,
momentum = 0.0001,
training.style = "stochastic",
max.iter = 100,
normalization = "z-transform",
weight.init = "normal",
thread.ratio = 0.3,
categorical.variable = "V003")
Output:
> mlpc$train.log$Collect()
ITERATION ERROR
1 1 1.080261
2 2 1.008358
3 3 0.947069
4 4 0.894585
5 5 0.849411
.. ... ...
92 92 0.317840
93 93 0.316630
94 94 0.315376
95 95 0.314210
96 96 0.313066
97 97 0.312021
98 98 0.310916
99 99 0.309770
100 100 0.308704
Model evaluation example:
Training the model:
> mlpc <- hanaml.MLPClassifier(data = df, label= "LABEL",
hidden.layer.size = c(10,10),
activation = "tanh" ,output.activation = "tanh",
learning.rate = 0.001, momentum=0.00001,
training.style = "stochastic",
categorical.variable = "V003", max.iter = 100,
normalization = "z-transform",
weight.init = "normal", thread.ratio = 0.3,
resampling.method = "cv",
evaluation.metric = "f1_score",
fold.num = 10, repeat.times = 2,
random.state = 1, progress.indicator.id = "TEST")
Parameter Selection Example:
> mlpc <- hanaml.MLPClassifier(data = df, label= "LABEL",
learning.rate=0.001, momentum=0.00001,
training.style="stochastic",
categorical.variable = "V003",
max.iter = 100, normalization = "z-transform",
weight.init = "normal", thread.ratio = 0.3,
resampling.method = "stratified_bootstrap",
evaluation.metric = "ACCURACY",
param.search.strategy = "grid",
repeat.times = 2, random.state = 1,
progress.indicator.id = "TEST",
parameter.values = list("hidden.layer.size" =
list(c(10,10), c(5,5,5)),
"activation" =
c("tanh",
"linear",
"sigmoid-asymmetric"),
"output.activation" =
c("sigmoid-symmetric",
"gaussian-asymmetric",
"gaussian-symmetric")))
Output:
Optimal Parameters: 1 PARAM_NAME INT_VALUE DOUBLE_VALUE STRING_VALUE 2 HIDDEN_LAYER_SIZE NA NA 10,10 3 OUTPUT_LAYER_ACTIVE_FUNC 4 NA <NA> 4 HIDDEN_LAYER_ACTIVE_FUNC 1 NA <NA>