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

Multi-dimensional Scaling

Description

hanaml.MDS is a R wrapper for PAL Multi-dimensional scaling(MDS) algorithm.

Usage

hanaml.MDS(conn.context,
                  data,
                  key,
                  features = NULL,
                  matrix.type,
                  thread.ratio = NULL,
                  dim = NULL,
                  metric = NULL,
                  minkowski.power = NULL)

Arguments

conn.context

ConnectionContext
Database connection object.

data

DataFrame
Dataset used for training the MDS model.

key

character
Specifies ID column of the training data.

features

list, optional
Specifies the feature columns to apply scaling to.

matrix.type

integer

The type of the input table:

  • "observation_feature": Observation-feature matrixc

  • "dissimilarity": Dissimilarity matrix

thread.ratio

double, optional
Specifies the ratio of total number of threads that can be used by this function. The value range is from 0 to 1, where 0 means only using 1 thread, and 1 means using at most all the currently available threads. Values outside the range will be ignored and this function heuristically determines the number of threads to use.

dim

integer, optional
The number of dimension that the input dataset is to be reduced to.

metric

chracter, optional

The type of distance during the calculation of dissimilarity matrix:

  • "manhattan": Manhattan distance

  • "euclidean": Euclidean distance

  • "minkowski": Minkowski distance

minkowski.power

double, optional
When you use the Minkowski distance, this parameter controls the value of power.

Format

R6Class object.

Value

Examples

## Not run: 
 Input DataFrame for Multidimensional Scaling:

  > data$collect()
  ID        X1        X2        X3        X4
1  1 0.0000000 0.9047814 0.9085961 0.9103063
2  2 0.9047814 0.0000000 0.2514457 0.5975016
3  3 0.9085961 0.2514457 0.0000000 0.4403572
4  4 0.9103063 0.5975016 0.4403572 0.0000000

Training the model:
> mds <- hanaml.MDS(conn, data, matrix.type = "dissimilarity",
                    thread.ratio = 0.5)

expected output:
> mds$labels$Collect()
    ID   DIMENSION   VALUE
  1  1         1  0.65191741
  2  1         2 -0.01585861
  3  2         1 -0.21773716
  4  2         2 -0.25319456
  5  3         1 -0.24990695
  6  3         2 -0.07294968
  7  4         1 -0.18427330
  8  4         2  0.34200285

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]