enpls.od: Ensemble Partial Least Squares for Outlier Detection

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

Description

Outlier detection with ensemble partial least squares.

Usage

1
2
enpls.od(x, y, maxcomp = NULL, cvfolds = 5L, reptimes = 500L,
  method = c("mc", "boot"), ratio = 0.8, parallel = 1L)

Arguments

x

Predictor matrix.

y

Response vector.

maxcomp

Maximum number of components included within each model. If not specified, will use the maximum number possible (considering cross-validation and special cases where n is smaller than p).

cvfolds

Number of cross-validation folds used in each model for automatic parameter selection, default is 5.

reptimes

Number of models to build with Monte-Carlo resampling or bootstrapping.

method

Resampling method. "mc" (Monte-Carlo resampling) or "boot" (bootstrapping). Default is "mc".

ratio

Sampling ratio used when method = "mc".

parallel

Integer. Number of CPU cores to use. Default is 1 (not parallelized).

Value

A list containing four components:

Note

To maximize the probablity that each observation can be selected in the test set (thus the prediction uncertainty can be measured), please try setting a large reptimes.

Author(s)

Nan Xiao <https://nanx.me>

See Also

See enpls.fs for measuring feature importance with ensemble partial least squares regressions. See enpls.fit for fitting ensemble partial least squares regression models.

Examples

1
2
3
4
5
6
7
8
9
data("alkanes")
x <- alkanes$x
y <- alkanes$y

set.seed(42)
od <- enpls.od(x, y, reptimes = 50)
print(od)
plot(od)
plot(od, criterion = "sd")

Example output

Outlier Detection by Ensemble Partial Least Squares
---
Mean residual for each sample:
  [1]  5.84154296 12.47806291  3.81790035  4.22732663  3.64200539  1.45816568
  [7]  3.82228162  0.18208175  1.80999574  0.06827347  1.58355387  0.09719581
 [13]  4.46895125  1.09506599  0.08924130  4.59801048  1.40660823  0.33483739
 [19]  1.30951672  2.56468327  0.18103997  0.06311843  2.58922775  0.40418221
 [25]  0.41989207  3.77170259  0.34084568  0.79670820  3.68565693  0.63575832
 [31]  2.77204396  0.14174109  0.47094341  0.36565988  0.79524498  1.44100432
 [37]  2.10865878  1.68203946  2.07017919  0.05239392  0.83380468  2.28572307
 [43]  1.29343207  2.08150687  1.94819654  1.37337764  1.65380364  1.67898556
 [49]  2.94098977  2.15550724  1.01751815  1.07208796  6.38985197  1.90876411
 [55]  1.11273054  1.04644571  2.96215013  4.30769213  0.77938100  0.15775730
 [61]  0.04739812  3.01216209 17.06483526  6.32480343  0.82381142  3.01461622
 [67]  2.36442108  0.29542554  1.88379932  1.50950251  0.33608295  1.07837451
 [73]  0.18021758  1.98601162  0.09532529  3.03828609  0.85836585  1.27847456
 [79]  2.06976436  1.40505134  0.05343708  0.11830765  6.53174820  0.59329915
 [85]  2.36768716  1.84198659  1.53185852  2.06433590  0.56460902  0.65894607
 [91]  1.17386761  4.19784770  0.75272292  3.07360962  7.66314227  1.77243645
 [97]  3.10243664  1.88351042  1.46783449  0.86665889  1.06975279  1.73141152
[103]  1.25242872  0.72679447  0.67700199  1.90487897  0.32623722  0.17275968
[109]  3.31546253  2.65631581  2.19352580  3.03167601  3.40983960  2.58540753
[115]  1.34987358  0.12336024  4.05420830  1.79451991  2.78250581  4.38811945
[121]  2.08185290  3.88090100  0.09822433  2.76353595  0.82363858  1.57060169
[127]  0.35505686  0.38341842  0.69607475  4.46346442  5.32305428  4.97492485
[133]  1.36303078  0.57191267  3.20915540  0.16609063  0.64980356  4.39615174
[139]  4.89497357  6.47747600  3.03211857  0.63532671  2.40129215  3.49868967
[145]  1.00230619  1.27776071  4.12158668  3.19242117  0.11901725  3.43670453
[151]  2.48235258  2.43879266  0.39595805  1.57980158  9.43447488  2.14978953
[157]  2.27536927  1.33705528  2.48581170  3.23826480  0.74783113  0.78230002
[163]  6.18085104  1.63200583  5.86373399  1.14837185 12.52970752  7.91332023
[169]  4.53028748  0.57666780  1.23241782  3.86693174  3.51306569  9.07703932
[175]  6.18490920  3.94541124  4.97217452  0.88037862  0.52783855  2.36473984
[181]  2.31003275  1.40199253  3.54404560  0.95981248  5.13350268  0.89141571
[187]  2.91237604  3.28767279  1.42116708  0.34381605  4.45188124  0.63585551
[193]  4.59764059  1.42524186  3.77003282  0.35955457 10.41408740  4.15160946
[199]  8.12371623  3.66031387  3.50346485  3.23856551  1.25130157  5.08311486
[205]  1.68704502  3.11000898  5.54746155
---
Residual SD for each sample:
  [1] 3.7580716 3.0433650 2.3043098 2.8376277 2.0894200 0.7637105 1.0040221
  [8] 0.8169191 1.6294251 0.8097289 1.2067250 0.7404114 1.2197478 0.8259262
 [15] 0.7240018 1.1471616 0.7482086 0.4912596 1.0309151 0.6357447 0.6051036
 [22] 0.4166593 0.9054018 0.5448250 0.4890459 0.8880332 0.6142908 0.5993957
 [29] 0.9151949 0.5277489 0.6814105 0.4482781 0.6346327 0.3005939 0.7013371
 [36] 0.7939135 0.9410419 0.3764690 0.7970728 0.5895069 0.5967042 0.3654937
 [43] 0.4758814 0.8378033 0.4075352 0.3555695 0.9441589 0.4543417 0.4509223
 [50] 0.5245863 0.4479285 0.6817372 0.5206553 1.2516662 0.5110322 0.4063994
 [57] 0.4387259 0.3613608 0.2977674 0.4327901 0.5932707 0.4962887 0.3126776
 [64] 0.4020826 1.6003312 0.5284284 0.4339982 0.4858774 0.4382184 0.4319390
 [71] 0.4761075 0.5556712 0.7688055 0.4521190 1.2368325 0.4586641 0.6084671
 [78] 0.4137158 0.4639920 0.3352623 0.2820102 0.4182374 0.5502604 0.5094407
 [85] 0.6344731 0.3365829 0.2515227 0.7153839 0.4402040 0.4166187 0.2995878
 [92] 0.6704716 0.8008601 0.3388109 0.3262772 0.3520078 0.5061787 0.4852360
 [99] 0.3079973 0.3934575 0.6198711 0.4237787 0.2720384 0.4787153 0.6637957
[106] 0.3712932 0.4683990 0.6202247 0.2721590 0.6097487 0.3722277 0.3373905
[113] 0.5557479 0.4808776 0.8486943 0.7396232 1.0609978 0.7444840 1.1927777
[120] 1.8089168 0.8603471 0.6739453 0.5404603 0.6503700 0.7632484 1.4585867
[127] 0.3593919 0.2831706 0.8168057 0.3198876 0.8321675 1.5685052 0.8006221
[134] 0.4769935 0.6003442 0.4634613 0.7788567 0.3633180 0.5020792 0.9293973
[141] 0.7229372 0.5199577 0.2625200 0.6063737 0.5104528 0.4353744 0.2733955
[148] 0.4343043 0.4741539 0.6842340 0.4453425 0.4175046 0.8309930 0.3047612
[155] 0.6471711 0.5918122 0.4111067 0.8691659 0.5743590 0.9864279 1.0990263
[162] 0.4793320 1.1497748 0.4111816 0.9485608 0.5504446 1.0434053 0.4757830
[169] 0.8209757 3.5441632 0.6384631 0.8944721 0.7012970 0.8933153 0.7755183
[176] 0.6341576 0.4650354 0.6619321 0.3599368 1.3004339 0.7067686 0.4449671
[183] 0.4325338 0.5052929 0.6256768 0.3037975 0.2971248 1.6346700 0.4998850
[190] 0.7110678 0.2831014 0.2707466 0.5343123 0.5010535 0.6825202 0.5588634
[197] 1.8977247 0.3210785 0.5229016 0.4318806 0.6036395 0.8095024 0.3457949
[204] 0.5229946 0.9623443 0.5953698 0.4750229

enpls documentation built on May 18, 2019, 9:02 a.m.