randomFourierTrans: Random Fourier transformation

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Calculates the random Fourier transformation using a Gaussian kernel, given the original data.

Usage

1
randomFourierTrans(X, Dim, sigma, seedW=NULL)

Arguments

X

Original data design matrix. All factors have to be encoded, e.g. dummy coding.

Dim

Specifies the dimension of the random Fourier transformation (integer scalar).

sigma

Variance of the Gaussian kernel (positive numeric scalar).

seedW

Random seed for drawing from the multivariate normal distribution (integer scalar).

Details

First a random weight matrix is drawn from the multivariate normal distribution. Then the Data is linear transformed. The linear transformed data is mapped nonlinear by applying cosinus and sinus functions. The matrix multiplaction t(Z) Z approximates the Gaussian radial basis function kernel matrix. The dimension of t(Z) Z is always n x n. The higher the dimension argument Dim, the more accurate the results.

Value

Numeric transformed data matrix with dimension 2*Dim x n.

Note

This function is not intended to be called directly by the user. Should only be used by experienced users, who want to customize the model. It is called in the estimation process of the kernel deep stacking network, e. g. fitKDSN.

Author(s)

Thomas Welchowski welchow@imbie.meb.uni-bonn.de

References

Po-Seng Huang and Li Deng and Mark Hasegawa-Johnson and Xiaodong He, (2013), Random Features for kernel deep convex network, Proceedings IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP)

See Also

fourierTransPredict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Generate data matrix
X <- data.frame(rnorm(100), rnorm(100), rnorm(100), rnorm(100), rnorm(100), 
factor(sample(c("a", "b", "c", "d", "e"), 100, replace=TRUE)))
X <- model.matrix(object=~., data=X) 
# Exclude intercept
X <- X[, -1]

# Apply a random Fourier transformation of lower dimension
rft <- randomFourierTrans(X=X, Dim=2, sigma=1, seedW=0)

# Transformed data
rft$Z

# Used weight matrix
rft$rW

Example output

              1           2           3          4          5          6
[1,] -0.6768542  0.06518136  0.37574669 -0.4966198  0.2116745 -0.6957784
[2,]  0.3492194 -0.02217395 -0.07460965 -0.3223374 -0.1042314 -0.1078658
[3,]  0.2046176  0.70409615 -0.59901121 -0.5033575 -0.6746806 -0.1260650
[4,] -0.6148543 -0.70675902 -0.70315958 -0.6293636 -0.6993825 -0.6988311
               7          8          9          10         11         12
[1,]  0.69105856 -0.7033352  0.2280896 -0.58519755  0.4369952  0.1196931
[2,]  0.70157574  0.1506943  0.6763112 -0.01823611 -0.1861371  0.6951943
[3,] -0.14979343  0.0729352 -0.6693094 -0.39691791  0.5559094 -0.6969028
[4,] -0.08826933 -0.6908627  0.2064054 -0.70687159 -0.6821678  0.1292472
             13           14         15         16          17         18
[1,] 0.70695623 -0.007774136 -0.1264757  0.5794750 -0.31703790 -0.1131224
[2,] 0.42375915 -0.289303651 -0.3219197 -0.5014517 -0.02369032  0.3715694
[3,] 0.01459093 -0.707064044  0.6957039  0.4052267  0.63204982 -0.6979995
[4,] 0.56606376 -0.645215776 -0.6295774  0.4985441 -0.70670982 -0.6016113
             19         20         21         22         23          24
[1,] -0.3757473 -0.2962527  0.4892643  0.6900373  0.6576961  0.70474686
[2,] -0.2075915  0.6924681 -0.6726804  0.3516366 -0.5774959  0.70643452
[3,] -0.5990108 -0.6420548  0.5105100 -0.1544296 -0.2596841 -0.05772235
[4,] -0.6759481 -0.1431358  0.2179474 -0.6134751 -0.4080423  0.03082639
             25         26        27          28         29         30
[1,] -0.5496335  0.5746423 0.5398372  0.70364977  0.6280840  0.1995324
[2,]  0.5224096 -0.4557251 0.1004139 -0.60804340 -0.1753904  0.1723662
[3,] -0.4448629 -0.4120513 0.4567011  0.06983557  0.3248238  0.6783707
[4,] -0.4765377 -0.5406613 0.6999408  0.36094768  0.6850096 -0.6857769
             31          32         33         34         35         36
[1,]  0.4751279 -0.70419908 -0.5039069 -0.5734239 -0.6513926 0.70414129
[2,] -0.5875164 -0.66287988 -0.6731966 -0.3763735  0.6919277 0.25444629
[3,]  0.5236922  0.06405978 -0.4960624 -0.4137452  0.2751140 0.06469196
[4,]  0.3934774  0.24615091  0.2163479 -0.5986176  0.1457262 0.65974017
              37          38          39         40         41         42
[1,] -0.45774705 -0.43030499 -0.37941222 -0.6893329 -0.3836145  0.6302268
[2,] -0.04395341  0.70617646  0.70516899  0.6005624  0.6854794 -0.6862402
[3,]  0.53895050  0.56110393 -0.59669621 -0.1575439 -0.5940033  0.3206465
[4,]  0.70573940  0.03626023 -0.05231343 -0.3732624 -0.1735455 -0.1705120
             43          44         45         46         47          48
[1,]  0.4481718 -0.06688803  0.5574169 -0.1554992 -0.6764785 -0.05420061
[2,] -0.1452655  0.40735823 -0.6293407  0.5301814 -0.6829140 -0.46689791
[3,] -0.5469388 -0.70393607 -0.4350706  0.6897971  0.2058564  0.70502645
[4,]  0.6920245 -0.57797861 -0.3223822  0.4678757 -0.1833808  0.53104269
              49         50         51         52         53         54
[1,]  0.09509576  0.5890203 -0.1564418  0.6729081  0.5586952 0.70533602
[2,] -0.64477294 -0.5864054  0.6556075  0.4252111  0.2795350 0.67464677
[3,] -0.70068309  0.3912226 -0.6895839 -0.2172434  0.4334278 0.05001101
[4,] -0.29028926 -0.3951313  0.2649128  0.5649739 -0.6495076 0.21178228
             55         56         57         58         59         60
[1,] -0.6941409  0.6357694 -0.6139404 -0.4672658 -0.5822574 -0.6103480
[2,] -0.0601951 -0.7070251 -0.5515105 -0.6866633  0.4552573 -0.3945281
[3,] -0.1347902 -0.3095114  0.3508236  0.5307190 -0.4012186  0.3570368
[4,]  0.7045400  0.0107501 -0.4425338 -0.1688004 -0.5410553  0.5868113
             61           62         63         64         65         66
[1,] -0.3817181  0.442195604  0.6886047 -0.3552308  0.3422321  0.4317433
[2,]  0.6064485  0.707064316 -0.6824990 -0.2361022 -0.5375347  0.5686151
[3,]  0.5952237  0.551781703 -0.1606972 -0.6114009  0.6187707  0.5599979
[4,]  0.3636209 -0.007749402 -0.1849190  0.6665251  0.4594088 -0.4203294
            67         68          69         70         71         72
[1,] 0.3545455 0.02092007 -0.49166916  0.2158926 -0.5574443 -0.3517345
[2,] 0.1894578 0.48020264  0.01964352 -0.5935104 -0.2428423  0.6445356
[3,] 0.6117986 0.70679725  0.50819429  0.6733427  0.4350354  0.6134190
[4,] 0.6812531 0.51904279  0.70683388  0.3843767  0.6640991  0.2908159
             73         74         75         76           77        78
[1,] -0.5703013  0.5049933  0.6743196  0.1960560  0.707105544 0.6949206
[2,] -0.1333144 -0.4403271  0.2697302 -0.5959668 -0.695531388 0.6585525
[3,] -0.4180388 -0.4949564  0.2128218 -0.6793836 -0.001322944 0.1307110
[4,]  0.6944259 -0.5532739 -0.6536403 -0.3805570  0.127420909 0.2575047
             79          80         81          82         83         84
[1,] -0.4059327 -0.69964604 -0.5844763  0.02187418 -0.6446698 -0.1139828
[2,]  0.4896442 -0.70380678  0.6231884 -0.57440364  0.5258785  0.5088547
[3,] -0.5789807  0.10244712 -0.3979793 -0.70676836 -0.2905183  0.6978595
[4,]  0.5101457 -0.06823504  0.3341202  0.41238387  0.4727069  0.4909856
             85        86         87         88         89          90
[1,] -0.2795250 0.6081966  0.4727968  0.5580410 -0.3897197 -0.70600778
[2,]  0.4408189 0.6592868 -0.4448786 -0.6805647 -0.6395227  0.65487346
[3,] -0.6495120 0.3606895  0.5257977  0.4342697 -0.5900157  0.03940832
[4,] -0.5528821 0.2556186 -0.5496208  0.1919159 -0.3016797  0.26672223
              91         92         93         94           95         96
[1,] -0.12821076  0.6503966  0.3944287 -0.3011872 -0.707104290  0.6372164
[2,]  0.04561059  0.5251767  0.2210298 -0.2876970 -0.638930719 -0.4017070
[3,] -0.69538622 -0.2774603 -0.5868782  0.6397549 -0.001876917 -0.3065212
[4,]  0.70563424  0.4734865 -0.6716739  0.6459338 -0.302931570  0.5819205
             97         98        99        100
[1,]  0.5534907 -0.1474283 0.6057833  0.2896121
[2,] -0.5238570  0.4906468 0.6735207 -0.4852095
[3,]  0.4400546 -0.6915670 0.3647281  0.6450774
[4,]  0.4749461 -0.5091814 0.2153366 -0.5143654
              [,1]       [,2]
 [1,]  1.262954285 -0.3262334
 [2,]  1.329799263  1.2724293
 [3,]  0.414641434 -1.5399500
 [4,] -0.928567035 -0.2947204
 [5,] -0.005767173  2.4046534
 [6,]  0.763593461 -0.7990092
 [7,] -1.147657009 -0.2894616
 [8,] -0.299215118 -0.4115108
 [9,]  0.252223448 -0.8919211

kernDeepStackNet documentation built on May 2, 2019, 8:16 a.m.