hanaml.MulticlassAuc {hana.ml.r}R Documentation

Area Under Curve with Multi-class

Description

hanaml.MulticlassAuc is a R wrapper for PAL multi-class Auc.

Usage

hanaml.MulticlassAuc(conn.context,
                          data.original,
                          data.predict,
                          key = NULL)

Arguments

conn.context

ConnectionContext
The connection to the SAP HANA system.

data.original

DataFrame
True class data, structured as follows:

  • ID, INTEGER - column with index.

  • True Class, INTEGER-true data point.

data.predict

DataFrame
True class data, structured as follows:

  • ID, INTEGER - column with index.

  • True Class, INTEGER - true data point.

  • Classifier, DOUBLE - Classifier-computed probability that the data point belongs to that particular class.

key

integer
Name of ID column.

Format

R6Class object.

Value

Return a "MulticlassAuc" object with following values: auc : double
The area under the receiver operating characteristic curve.

roc : DataFrame
False positive rate and true positive rate, structured as follows:

Note

For each data point ID, there should be one row for each possible class.

See Also

hanaml.Auc

Examples

## Not run: 
Input DataFrame data.original and data.predict:

> data.original$Collect()

    ID  ORIGINAL
0   1         1
1   2         1
2   3         1
3   4         2
4   5         2
5   6         2
6   7         3
7   8         3
8   9         3
9  10         3

> data.predict$Collect()

    ID  PREDICT  PROB
0    1        1  0.90
1    1        2  0.05
2    1        3  0.05
3    2        1  0.80
4    2        2  0.05
5    2        3  0.15
6    3        1  0.80
7    3        2  0.10
8    3        3  0.10
9    4        1  0.10
10   4        2  0.80
11   4        3  0.10
12   5        1  0.20
13   5        2  0.70
14   5        3  0.10
15   6        1  0.05
16   6        2  0.90
17   6        3  0.05
18   7        1  0.10
19   7        2  0.10
20   7        3  0.80
21   8        1  0.00
22   8        2  0.00
23   8        3  1.00
24   9        1  0.20
25   9        2  0.10
26   9        3  0.70
27  10        1  0.20
28  10        2  0.20
29  10        3  0.60

Compute Area Under Curve for multi class:

>  multiauc_fit <- hanaml.MulticlassAuc(conn.context = conn,
                                        data.original = data.original,
                                        data.predict = data.predict)

Output:

>multiauc_fit$auc
 1

>multiauc_fit$roc$Collect()

    ID   FPR  TPR
0    0  1.00  1.0
1    1  0.90  1.0
2    2  0.65  1.0
3    3  0.25  1.0
4    4  0.20  1.0
5    5  0.00  1.0
6    6  0.00  0.9
7    7  0.00  0.7
8    8  0.00  0.3
9    9  0.00  0.1
10  10  0.00  0.0

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]