hanaml.WST is a R wrapper for SAP HANA PAL WEIGHTED SCORE TABLE

hanaml.WST(
  data,
  key = NULL,
  features = NULL,
  map = NULL,
  weights = NULL,
  thread.ratio = NULL
)

Arguments

data

DataFrame
DataFrame containting the data.

key

character, optional
Name of the ID column.
Defaults to the first column if not provided.

features

character of list of characters, optional
Name of feature columns.
If not provided, it defaults all non-key, non-label columns of data.

map

DataFrame
Every attribute (except ID) in the input data table maps to two columns in the map Function table: Key column and Value column. The Value column must be of double type.

weights

DataFrame
This table has three columns. When the data table has n attributes (except ID), the weights table will have n rows.

thread.ratio

double, optional
Controls the proportion of available threads that can be used by this function.
The value range is from 0 to 1, where 0 indicates a single thread, and 1 indicates all available threads.
Values between 0 and 1 will use up to that percentage of available threads.Values outside this range are ignored.
Defaults to 0.

Value

DataFrame
Weighted score table result, structured as:

  • ID: ID (correspond to input table).

  • SCORE: Result value.

Details

A weighted score table is a method of evaluating alternatives when the importance of each criterion differs. In a weighted score table, each alternative is given a score for each criterion. These scores are then weighted by the importance of each criterion. All of an alternative's weighted scores are then added together to calculate its total weighted score. The alternative with the highest total score should be the best alternative. A function defined by weighted score tables is a linear combination of functions of a variable: f(x1,...,xn) = w1f1(x1) + ... + wnfn(xn)

Examples


> data$Collect()
     ITEM  VALUE
1   item1  15.40
2   item2 200.40
3   item3 280.40
4   item4 100.90
5   item5  40.40
6   item6  25.60
7   item7  18.40
8   item8  10.50
9   item9  96.15
10 item10   9.40

> map$Collect()
  GENDER VAL1 INCOME VAL2 HEIGHT VAL3
1   male  2.0      0    0   1.50    0
2 female  1.5   5500    1   1.60    1
3   <NA>  0.0   9000    2   1.71    2
4   <NA>  0.0  12000    3   1.80    3

> weights$Collect()
  WEIGHT ISDIS ROWNUM
1    0.5     1      2
2    2.0    -1      4
3    1.0    -1      4

Call the function:


> result -> hanaml.WST(data = data, map = map, weights = weights,
                       thread.ratio = 0.5)

Results:


> result$Collect()
   ID SCORE
1   0  3.00
2   1  8.00
3   2  2.75
4   3  8.00
5   4  1.75
6   5  7.75
7   6  2.00
8   7  4.00
9   8  5.75
10  9  7.75