5.2.12 Singular Value Decomposition

The overloaded svd function performs singular value decomposition in parallel in the database.

The svd function accepts an ore.frame or an ore.tblmatrix object as the x argument. The ore.odmSVD method distributes block SVD computation to parallel processes executing in the database. The method uses the global option ore.parallel to determine the degree of parallelism to employ.

The function returns a list object that contains the d vector and v matrix components of a singular value decomposition of argument x. It does not return the left singular vector matrix u, therefore the argument nu is not used.

For details about the function arguments, call help(ore.odmSVD).

Example 5-69 Using the svd Function

IRIS <- ore.push(cbind(Id = seq_along(iris[[1L]]), iris))
     
     svd.mod <- ore.odmSVD(~. -Id, IRIS)
     summary(svd.mod)
     d(svd.mod)
     v(svd.mod)
     head(predict(svd.mod, IRIS, supplemental.cols = "Id"))
     
     svd.pmod <- ore.odmSVD(~. -Id, IRIS, 
                   odm.settings = list(odms_partition_columns = "Species"))
     summary(svd.pmod)
     d(svd.pmod)
     v(svd.pmod)
     head(predict(svd.pmod, IRIS, supplemental.cols = "Id"))

Listing for This Example

R> summary(svd.pmod)
     R> d(svd.pmod)
     R> v(svd.pmod)
     R> head(predict(svd.pmod, IRIS, supplemental.cols = "Id"))
Call:
ore.odmSVD(formula = ~. - Id, data = IRIS)

Settings: 
                                               value
odms.details                             odms.enable
odms.missing.value.treatment odms.missing.value.auto
odms.sampling                  odms.sampling.disable
prep.auto                                         ON
scoring.mode                             scoring.svd
u.matrix.output                     u.matrix.disable

d: 
  FEATURE_ID      VALUE
1          1 96.2182677
2          2 19.0780817
3          3  7.2270380
4          4  3.1502152
5          5  1.8849634
6          6  1.1474731
7          7  0.5814097
v: 
  ATTRIBUTE_NAME ATTRIBUTE_VALUE        '1'         '2'          '3'
1   Petal.Length            <NA> 0.51162932  0.65943465 -0.004420703
2    Petal.Width            <NA> 0.16745698  0.32071102  0.146484369
3   Sepal.Length            <NA> 0.74909171 -0.26482593 -0.102057243
4    Sepal.Width            <NA> 0.37906736 -0.50824062  0.142810811
5        Species          setosa 0.03170407 -0.32247642  0.184499940
6        Species      versicolor 0.04288799  0.04054823 -0.780684855
7        Species       virginica 0.05018593  0.16796988  0.551546107
          '4'         '5'         '6'          '7'
1  0.05479795 -0.51969015  0.17392232 -0.005674672
2  0.46553390  0.72685033  0.31962337 -0.021274748
3 -0.49272847  0.31969417 -0.09379235 -0.067308615
4  0.69139828 -0.25849391 -0.17606099 -0.041908520
5 -0.12245506 -0.14348647  0.76017824  0.497502783
6  0.19827972  0.07363250 -0.12354271  0.571881302
7 -0.07177990  0.08109974 -0.48442099  0.647048040