A class to hold the results of of a dimensionality reduction.
Usage
# S4 method for dimRedResult
predict(object, xnew)
# S4 method for dimRedResult
inverse(object, ynew)
# S4 method for dimRedResult
as.data.frame(
x,
org.data.prefix = "org.",
meta.prefix = "meta.",
data.prefix = ""
)
# S4 method for dimRedResult
getPars(object)
# S4 method for dimRedResult
getNDim(object)
# S4 method for dimRedResult
print(x)
# S4 method for dimRedResult
getOrgData(object)
# S4 method for dimRedResult
getDimRedData(object)
# S4 method for dimRedResult
ndims(object)
# S4 method for dimRedResult
getOtherData(object)
Arguments
- object
Of class
dimRedResult
- xnew
new data, of type
dimRedData
- ynew
embedded data, of type
dimRedData
- x
Of class
dimRedResult
- org.data.prefix
Prefix for the columns of the org.data slot.
- meta.prefix
Prefix for the columns of
x@data@meta
.- data.prefix
Prefix for the columns of
x@data@data
.
Methods (by generic)
predict(dimRedResult)
: apply a trained method to new data, does not work with all methods, will give an error if there is noapply
. In some cases the apply function may only be an approximation.inverse(dimRedResult)
: inverse transformation of embedded data, does not work with all methods, will give an error if there is noinverse
. In some cases the apply function may only be an approximation.as.data.frame(dimRedResult)
: convert todata.frame
getPars(dimRedResult)
: Get the parameters with which the method was called.getNDim(dimRedResult)
: Get the number of embedding dimensions.print(dimRedResult)
: Method for printing.getOrgData(dimRedResult)
: Get the original data and meta.datagetDimRedData(dimRedResult)
: Get the embedded datandims(dimRedResult)
: Extract the number of embedding dimensions.getOtherData(dimRedResult)
: Get other data produced by the method
Slots
data
Output data of class dimRedData.
org.data
original data, a matrix.
apply
a function to apply the method to out-of-sampledata, may not exist.
inverse
a function to calculate the original coordinates from reduced space, may not exist.
has.org.data
logical, if the original data is included in the object.
has.apply
logical, if a forward method is exists.
has.inverse
logical if an inverse method exists.
method
saves the method used.
pars
saves the parameters used.
other.data
other data produced by the method, e.g. a distance matrix.
Examples
## Create object by embedding data
iris.pca <- embed(loadDataSet("Iris"), "PCA")
## Convert the result to a data.frame
head(as(iris.pca, "data.frame"))
#> meta.Species PC1 PC2 Sepal.Length Sepal.Width Petal.Length
#> 1 setosa -2.684126 -0.3193972 5.1 3.5 1.4
#> 2 setosa -2.714142 0.1770012 4.9 3.0 1.4
#> 3 setosa -2.888991 0.1449494 4.7 3.2 1.3
#> 4 setosa -2.745343 0.3182990 4.6 3.1 1.5
#> 5 setosa -2.728717 -0.3267545 5.0 3.6 1.4
#> 6 setosa -2.280860 -0.7413304 5.4 3.9 1.7
#> Petal.Width
#> 1 0.2
#> 2 0.2
#> 3 0.2
#> 4 0.2
#> 5 0.2
#> 6 0.4
head(as.data.frame(iris.pca))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': cannot coerce class ‘structure("dimRedResult", package = "dimRed")’ to a data.frame
## There are no nameclashes to avoid here:
head(as.data.frame(iris.pca,
org.data.prefix = "",
meta.prefix = "",
data.prefix = ""))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': cannot coerce class ‘structure("dimRedResult", package = "dimRed")’ to a data.frame
## Print it more or less nicely:
print(iris.pca)
#> Method:
#> PCA
#> Parameters:
#> List of 2
#> $ center: logi TRUE
#> $ scale.: logi FALSE
## Get the embedded data as a dimRedData object:
getDimRedData(iris.pca)
#> An object of class "dimRedData"
#> Slot "data":
#> PC1 PC2
#> [1,] -2.684125626 -0.319397247
#> [2,] -2.714141687 0.177001225
#> [3,] -2.888990569 0.144949426
#> [4,] -2.745342856 0.318298979
#> [5,] -2.728716537 -0.326754513
#> [6,] -2.280859633 -0.741330449
#> [7,] -2.820537751 0.089461385
#> [8,] -2.626144973 -0.163384960
#> [9,] -2.886382732 0.578311754
#> [10,] -2.672755798 0.113774246
#> [11,] -2.506947091 -0.645068899
#> [12,] -2.612755231 -0.014729939
#> [13,] -2.786109266 0.235112000
#> [14,] -3.223803744 0.511394587
#> [15,] -2.644750390 -1.178764636
#> [16,] -2.386039034 -1.338062330
#> [17,] -2.623527875 -0.810679514
#> [18,] -2.648296706 -0.311849145
#> [19,] -2.199820324 -0.872839039
#> [20,] -2.587986400 -0.513560309
#> [21,] -2.310256215 -0.391345936
#> [22,] -2.543705229 -0.432996063
#> [23,] -3.215939416 -0.133468070
#> [24,] -2.302733182 -0.098708855
#> [25,] -2.355754049 0.037281860
#> [26,] -2.506668907 0.146016880
#> [27,] -2.468820073 -0.130951489
#> [28,] -2.562319906 -0.367718857
#> [29,] -2.639534715 -0.312039980
#> [30,] -2.631989387 0.196961225
#> [31,] -2.587398477 0.204318491
#> [32,] -2.409932497 -0.410924264
#> [33,] -2.648862334 -0.813363820
#> [34,] -2.598736749 -1.093145759
#> [35,] -2.636926878 0.121322348
#> [36,] -2.866241652 -0.069364472
#> [37,] -2.625238050 -0.599370021
#> [38,] -2.800684115 -0.268643738
#> [39,] -2.980502044 0.487958344
#> [40,] -2.590006314 -0.229043837
#> [41,] -2.770102426 -0.263527534
#> [42,] -2.849368705 0.940960574
#> [43,] -2.997406547 0.341926057
#> [44,] -2.405614485 -0.188871429
#> [45,] -2.209489238 -0.436663142
#> [46,] -2.714451427 0.250208204
#> [47,] -2.538148259 -0.503771144
#> [48,] -2.839462168 0.227945569
#> [49,] -2.543085750 -0.579410022
#> [50,] -2.703359782 -0.107706082
#> [51,] 1.284825689 -0.685160470
#> [52,] 0.932488532 -0.318333638
#> [53,] 1.464302322 -0.504262815
#> [54,] 0.183317720 0.827959012
#> [55,] 1.088103258 -0.074590675
#> [56,] 0.641669084 0.418246872
#> [57,] 1.095060663 -0.283468270
#> [58,] -0.749122670 1.004890961
#> [59,] 1.044131826 -0.228361900
#> [60,] -0.008745404 0.723081905
#> [61,] -0.507840884 1.265971191
#> [62,] 0.511698557 0.103981235
#> [63,] 0.264976508 0.550036464
#> [64,] 0.984934510 0.124817854
#> [65,] -0.173925372 0.254854209
#> [66,] 0.927860781 -0.467179494
#> [67,] 0.660283762 0.352969666
#> [68,] 0.236104993 0.333610767
#> [69,] 0.944733728 0.543145551
#> [70,] 0.045226976 0.583834377
#> [71,] 1.116283177 0.084616852
#> [72,] 0.357888418 0.068925032
#> [73,] 1.298183875 0.327787308
#> [74,] 0.921728922 0.182737794
#> [75,] 0.714853326 -0.149055944
#> [76,] 0.900174373 -0.328504474
#> [77,] 1.332024437 -0.244440876
#> [78,] 1.557802155 -0.267495447
#> [79,] 0.813290650 0.163350301
#> [80,] -0.305583778 0.368262190
#> [81,] -0.068126492 0.705172132
#> [82,] -0.189622472 0.680286764
#> [83,] 0.136428712 0.314032438
#> [84,] 1.380026436 0.420954287
#> [85,] 0.588006443 0.484287420
#> [86,] 0.806858313 -0.194182315
#> [87,] 1.220690882 -0.407619594
#> [88,] 0.815095236 0.372037060
#> [89,] 0.245957680 0.268524397
#> [90,] 0.166413217 0.681926725
#> [91,] 0.464800288 0.670711545
#> [92,] 0.890815198 0.034464444
#> [93,] 0.230548024 0.404385848
#> [94,] -0.704531759 1.012248228
#> [95,] 0.356981495 0.504910093
#> [96,] 0.331934480 0.212654684
#> [97,] 0.376215651 0.293218929
#> [98,] 0.642576008 -0.017738190
#> [99,] -0.906469865 0.756093367
#> [100,] 0.299000842 0.348897806
#> [101,] 2.531192728 0.009849109
#> [102,] 1.415235877 0.574916348
#> [103,] 2.616676016 -0.343903151
#> [104,] 1.971531053 0.179727904
#> [105,] 2.350005920 0.040260947
#> [106,] 3.397038736 -0.550836673
#> [107,] 0.521232244 1.192758727
#> [108,] 2.932587069 -0.355500003
#> [109,] 2.321228817 0.243831502
#> [110,] 2.916750967 -0.782791949
#> [111,] 1.661774154 -0.242228408
#> [112,] 1.803401953 0.215637617
#> [113,] 2.165591796 -0.216275585
#> [114,] 1.346163579 0.776818347
#> [115,] 1.585928224 0.539640714
#> [116,] 1.904456375 -0.119250692
#> [117,] 1.949689059 -0.041943260
#> [118,] 3.487055364 -1.175739330
#> [119,] 3.795645422 -0.257322973
#> [120,] 1.300791713 0.761149636
#> [121,] 2.427817913 -0.378196013
#> [122,] 1.199001105 0.606091528
#> [123,] 3.499920039 -0.460674099
#> [124,] 1.388766132 0.204399327
#> [125,] 2.275430504 -0.334990606
#> [126,] 2.614090474 -0.560901355
#> [127,] 1.258508161 0.179704795
#> [128,] 1.291132059 0.116668651
#> [129,] 2.123608723 0.209729477
#> [130,] 2.388003016 -0.464639805
#> [131,] 2.841672778 -0.375269167
#> [132,] 3.230673661 -1.374165087
#> [133,] 2.159437642 0.217277579
#> [134,] 1.444161242 0.143413410
#> [135,] 1.781294810 0.499901681
#> [136,] 3.076499932 -0.688085678
#> [137,] 2.144243314 -0.140064201
#> [138,] 1.905098149 -0.049300526
#> [139,] 1.169326339 0.164990262
#> [140,] 2.107611143 -0.372287872
#> [141,] 2.314154705 -0.183651279
#> [142,] 1.922267801 -0.409203467
#> [143,] 1.415235877 0.574916348
#> [144,] 2.563013375 -0.277862603
#> [145,] 2.418746183 -0.304798198
#> [146,] 1.944109795 -0.187532303
#> [147,] 1.527166615 0.375316983
#> [148,] 1.764345717 -0.078858855
#> [149,] 1.900941614 -0.116627959
#> [150,] 1.390188862 0.282660938
#>
#> Slot "meta":
#> Species
#> 1 setosa
#> 2 setosa
#> 3 setosa
#> 4 setosa
#> 5 setosa
#> 6 setosa
#> 7 setosa
#> 8 setosa
#> 9 setosa
#> 10 setosa
#> 11 setosa
#> 12 setosa
#> 13 setosa
#> 14 setosa
#> 15 setosa
#> 16 setosa
#> 17 setosa
#> 18 setosa
#> 19 setosa
#> 20 setosa
#> 21 setosa
#> 22 setosa
#> 23 setosa
#> 24 setosa
#> 25 setosa
#> 26 setosa
#> 27 setosa
#> 28 setosa
#> 29 setosa
#> 30 setosa
#> 31 setosa
#> 32 setosa
#> 33 setosa
#> 34 setosa
#> 35 setosa
#> 36 setosa
#> 37 setosa
#> 38 setosa
#> 39 setosa
#> 40 setosa
#> 41 setosa
#> 42 setosa
#> 43 setosa
#> 44 setosa
#> 45 setosa
#> 46 setosa
#> 47 setosa
#> 48 setosa
#> 49 setosa
#> 50 setosa
#> 51 versicolor
#> 52 versicolor
#> 53 versicolor
#> 54 versicolor
#> 55 versicolor
#> 56 versicolor
#> 57 versicolor
#> 58 versicolor
#> 59 versicolor
#> 60 versicolor
#> 61 versicolor
#> 62 versicolor
#> 63 versicolor
#> 64 versicolor
#> 65 versicolor
#> 66 versicolor
#> 67 versicolor
#> 68 versicolor
#> 69 versicolor
#> 70 versicolor
#> 71 versicolor
#> 72 versicolor
#> 73 versicolor
#> 74 versicolor
#> 75 versicolor
#> 76 versicolor
#> 77 versicolor
#> 78 versicolor
#> 79 versicolor
#> 80 versicolor
#> 81 versicolor
#> 82 versicolor
#> 83 versicolor
#> 84 versicolor
#> 85 versicolor
#> 86 versicolor
#> 87 versicolor
#> 88 versicolor
#> 89 versicolor
#> 90 versicolor
#> 91 versicolor
#> 92 versicolor
#> 93 versicolor
#> 94 versicolor
#> 95 versicolor
#> 96 versicolor
#> 97 versicolor
#> 98 versicolor
#> 99 versicolor
#> 100 versicolor
#> 101 virginica
#> 102 virginica
#> 103 virginica
#> 104 virginica
#> 105 virginica
#> 106 virginica
#> 107 virginica
#> 108 virginica
#> 109 virginica
#> 110 virginica
#> 111 virginica
#> 112 virginica
#> 113 virginica
#> 114 virginica
#> 115 virginica
#> 116 virginica
#> 117 virginica
#> 118 virginica
#> 119 virginica
#> 120 virginica
#> 121 virginica
#> 122 virginica
#> 123 virginica
#> 124 virginica
#> 125 virginica
#> 126 virginica
#> 127 virginica
#> 128 virginica
#> 129 virginica
#> 130 virginica
#> 131 virginica
#> 132 virginica
#> 133 virginica
#> 134 virginica
#> 135 virginica
#> 136 virginica
#> 137 virginica
#> 138 virginica
#> 139 virginica
#> 140 virginica
#> 141 virginica
#> 142 virginica
#> 143 virginica
#> 144 virginica
#> 145 virginica
#> 146 virginica
#> 147 virginica
#> 148 virginica
#> 149 virginica
#> 150 virginica
#>
## Get the original data including meta information:
getOrgData(iris.pca)
#> An object of class "dimRedData"
#> Slot "data":
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> [1,] 5.1 3.5 1.4 0.2
#> [2,] 4.9 3.0 1.4 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.2
#> [92,] 6.1 3.0 4.6 1.4
#> [93,] 5.8 2.6 4.0 1.2
#> [94,] 5.0 2.3 3.3 1.0
#> [95,] 5.6 2.7 4.2 1.3
#> [96,] 5.7 3.0 4.2 1.2
#> [97,] 5.7 2.9 4.2 1.3
#> [98,] 6.2 2.9 4.3 1.3
#> [99,] 5.1 2.5 3.0 1.1
#> [100,] 5.7 2.8 4.1 1.3
#> [101,] 6.3 3.3 6.0 2.5
#> [102,] 5.8 2.7 5.1 1.9
#> [103,] 7.1 3.0 5.9 2.1
#> [104,] 6.3 2.9 5.6 1.8
#> [105,] 6.5 3.0 5.8 2.2
#> [106,] 7.6 3.0 6.6 2.1
#> [107,] 4.9 2.5 4.5 1.7
#> [108,] 7.3 2.9 6.3 1.8
#> [109,] 6.7 2.5 5.8 1.8
#> [110,] 7.2 3.6 6.1 2.5
#> [111,] 6.5 3.2 5.1 2.0
#> [112,] 6.4 2.7 5.3 1.9
#> [113,] 6.8 3.0 5.5 2.1
#> [114,] 5.7 2.5 5.0 2.0
#> [115,] 5.8 2.8 5.1 2.4
#> [116,] 6.4 3.2 5.3 2.3
#> [117,] 6.5 3.0 5.5 1.8
#> [118,] 7.7 3.8 6.7 2.2
#> [119,] 7.7 2.6 6.9 2.3
#> [120,] 6.0 2.2 5.0 1.5
#> [121,] 6.9 3.2 5.7 2.3
#> [122,] 5.6 2.8 4.9 2.0
#> [123,] 7.7 2.8 6.7 2.0
#> [124,] 6.3 2.7 4.9 1.8
#> [125,] 6.7 3.3 5.7 2.1
#> [126,] 7.2 3.2 6.0 1.8
#> [127,] 6.2 2.8 4.8 1.8
#> [128,] 6.1 3.0 4.9 1.8
#> [129,] 6.4 2.8 5.6 2.1
#> [130,] 7.2 3.0 5.8 1.6
#> [131,] 7.4 2.8 6.1 1.9
#> [132,] 7.9 3.8 6.4 2.0
#> [133,] 6.4 2.8 5.6 2.2
#> [134,] 6.3 2.8 5.1 1.5
#> [135,] 6.1 2.6 5.6 1.4
#> [136,] 7.7 3.0 6.1 2.3
#> [137,] 6.3 3.4 5.6 2.4
#> [138,] 6.4 3.1 5.5 1.8
#> [139,] 6.0 3.0 4.8 1.8
#> [140,] 6.9 3.1 5.4 2.1
#> [141,] 6.7 3.1 5.6 2.4
#> [142,] 6.9 3.1 5.1 2.3
#> [143,] 5.8 2.7 5.1 1.9
#> [144,] 6.8 3.2 5.9 2.3
#> [145,] 6.7 3.3 5.7 2.5
#> [146,] 6.7 3.0 5.2 2.3
#> [147,] 6.3 2.5 5.0 1.9
#> [148,] 6.5 3.0 5.2 2.0
#> [149,] 6.2 3.4 5.4 2.3
#> [150,] 5.9 3.0 5.1 1.8
#>
#> Slot "meta":
#> Species
#> 1 setosa
#> 2 setosa
#> 3 setosa
#> 4 setosa
#> 5 setosa
#> 6 setosa
#> 7 setosa
#> 8 setosa
#> 9 setosa
#> 10 setosa
#> 11 setosa
#> 12 setosa
#> 13 setosa
#> 14 setosa
#> 15 setosa
#> 16 setosa
#> 17 setosa
#> 18 setosa
#> 19 setosa
#> 20 setosa
#> 21 setosa
#> 22 setosa
#> 23 setosa
#> 24 setosa
#> 25 setosa
#> 26 setosa
#> 27 setosa
#> 28 setosa
#> 29 setosa
#> 30 setosa
#> 31 setosa
#> 32 setosa
#> 33 setosa
#> 34 setosa
#> 35 setosa
#> 36 setosa
#> 37 setosa
#> 38 setosa
#> 39 setosa
#> 40 setosa
#> 41 setosa
#> 42 setosa
#> 43 setosa
#> 44 setosa
#> 45 setosa
#> 46 setosa
#> 47 setosa
#> 48 setosa
#> 49 setosa
#> 50 setosa
#> 51 versicolor
#> 52 versicolor
#> 53 versicolor
#> 54 versicolor
#> 55 versicolor
#> 56 versicolor
#> 57 versicolor
#> 58 versicolor
#> 59 versicolor
#> 60 versicolor
#> 61 versicolor
#> 62 versicolor
#> 63 versicolor
#> 64 versicolor
#> 65 versicolor
#> 66 versicolor
#> 67 versicolor
#> 68 versicolor
#> 69 versicolor
#> 70 versicolor
#> 71 versicolor
#> 72 versicolor
#> 73 versicolor
#> 74 versicolor
#> 75 versicolor
#> 76 versicolor
#> 77 versicolor
#> 78 versicolor
#> 79 versicolor
#> 80 versicolor
#> 81 versicolor
#> 82 versicolor
#> 83 versicolor
#> 84 versicolor
#> 85 versicolor
#> 86 versicolor
#> 87 versicolor
#> 88 versicolor
#> 89 versicolor
#> 90 versicolor
#> 91 versicolor
#> 92 versicolor
#> 93 versicolor
#> 94 versicolor
#> 95 versicolor
#> 96 versicolor
#> 97 versicolor
#> 98 versicolor
#> 99 versicolor
#> 100 versicolor
#> 101 virginica
#> 102 virginica
#> 103 virginica
#> 104 virginica
#> 105 virginica
#> 106 virginica
#> 107 virginica
#> 108 virginica
#> 109 virginica
#> 110 virginica
#> 111 virginica
#> 112 virginica
#> 113 virginica
#> 114 virginica
#> 115 virginica
#> 116 virginica
#> 117 virginica
#> 118 virginica
#> 119 virginica
#> 120 virginica
#> 121 virginica
#> 122 virginica
#> 123 virginica
#> 124 virginica
#> 125 virginica
#> 126 virginica
#> 127 virginica
#> 128 virginica
#> 129 virginica
#> 130 virginica
#> 131 virginica
#> 132 virginica
#> 133 virginica
#> 134 virginica
#> 135 virginica
#> 136 virginica
#> 137 virginica
#> 138 virginica
#> 139 virginica
#> 140 virginica
#> 141 virginica
#> 142 virginica
#> 143 virginica
#> 144 virginica
#> 145 virginica
#> 146 virginica
#> 147 virginica
#> 148 virginica
#> 149 virginica
#> 150 virginica
#>
## Get the number of variables:
ndims(iris.pca)
#> [1] 2