benmack / oneClass

One-class classification in the absence of test data.
GNU Affero General Public License v3.0
31 stars 12 forks source link

Issue when model trainOcc in parallel #6

Open woodysung opened 4 years ago

woodysung commented 4 years ago

Hello,

When running the trainOcc in parallel, the follow error was prompted. But this error was not prompted when not using parallel mode. Attached a reproducible R code for your reference. Thank!

In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, : There were missing values in resampled performance measures.**


library(oneClass) library(tidyverse)

register no of CPU cores used

doParallel:::registerDoParallel(7)

get the banana dataset

library(imbalance) data(banana) input_data <- banana

this is the default setting of trControl in trainOcc

cntrl <- trainControl(method = "cv", number = 5, summaryFunction = puSummary, #! classProbs = TRUE, #! savePredictions = TRUE, #! returnResamp = "all", #! allowParallel = TRUE)

tocc <- trainOcc(x=input_data [, -3], y=input_data [, 3], trControl=cntrl, method = "ocsvm") Setting direction: controls > cases Warning messages: 1: In .positiveLabel(y) : Positive label not given explicitly. The positive class is assumed to be the one with smaller frequency. 2 (pos): 0 samples 2 (un): 2640 samples 2: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, : There were missing values in resampled performance measures.

tocc one-class svm

2640 samples 2 predictor 2 classes: 'un', 'pos'

No pre-processing Resampling: Cross-Validated (5 fold) Summary of sample sizes: 2111, 2112, 2112, 2113, 2112 Resampling results across tuning parameters:

sigma nu tpr puP ppp puAuc puF puF1 pn 1e-03 0.01 NaN 0 NaN 0 0 0 NaN 1e-03 0.05 NaN 0 NaN 0 0 0 NaN 1e-03 0.10 NaN 0 NaN 0 0 0 NaN 1e-03 0.15 NaN 0 NaN 0 0 0 NaN 1e-03 0.20 NaN 0 NaN 0 0 0 NaN 1e-03 0.25 NaN 0 NaN 0 0 0 NaN 1e-02 0.01 NaN 0 NaN 0 0 0 NaN 1e-02 0.05 NaN 0 NaN 0 0 0 NaN 1e-02 0.10 NaN 0 NaN 0 0 0 NaN 1e-02 0.15 NaN 0 NaN 0 0 0 NaN 1e-02 0.20 NaN 0 NaN 0 0 0 NaN 1e-02 0.25 NaN 0 NaN 0 0 0 NaN 1e-01 0.01 NaN 0 NaN 0 0 0 NaN 1e-01 0.05 NaN 0 NaN 0 0 0 NaN 1e-01 0.10 NaN 0 NaN 0 0 0 NaN 1e-01 0.15 NaN 0 NaN 0 0 0 NaN 1e-01 0.20 NaN 0 NaN 0 0 0 NaN 1e-01 0.25 NaN 0 NaN 0 0 0 NaN 1e+00 0.01 NaN 0 NaN 0 0 0 NaN 1e+00 0.05 NaN 0 NaN 0 0 0 NaN 1e+00 0.10 NaN 0 NaN 0 0 0 NaN 1e+00 0.15 NaN 0 NaN 0 0 0 NaN 1e+00 0.20 NaN 0 NaN 0 0 0 NaN 1e+00 0.25 NaN 0 NaN 0 0 0 NaN 1e+01 0.01 NaN 0 NaN 0 0 0 NaN 1e+01 0.05 NaN 0 NaN 0 0 0 NaN 1e+01 0.10 NaN 0 NaN 0 0 0 NaN 1e+01 0.15 NaN 0 NaN 0 0 0 NaN 1e+01 0.20 NaN 0 NaN 0 0 0 NaN 1e+01 0.25 NaN 0 NaN 0 0 0 NaN 1e+02 0.01 NaN 0 NaN 0 0 0 NaN 1e+02 0.05 NaN 0 NaN 0 0 0 NaN 1e+02 0.10 NaN 0 NaN 0 0 0 NaN 1e+02 0.15 NaN 0 NaN 0 0 0 NaN 1e+02 0.20 NaN 0 NaN 0 0 0 NaN 1e+02 0.25 NaN 0 NaN 0 0 0 NaN

puF was used to select the optimal model using the largest value. The final values used for the model were sigma = 0.001 and nu = 0.01.

sessionInfo() R version 3.6.3 (2020-02-29) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Traditional)_Hong Kong SAR.950 LC_CTYPE=Chinese (Traditional)_Hong Kong SAR.950
[3] LC_MONETARY=Chinese (Traditional)_Hong Kong SAR.950 LC_NUMERIC=C
[5] LC_TIME=Chinese (Traditional)_Hong Kong SAR.950

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] oneClass_0.5.0 kernlab_0.9-29 pROC_1.16.2 caret_6.0-86 lattice_0.20-41 forcats_0.5.0
[7] stringr_1.4.0 dplyr_0.8.5 purrr_0.3.4 readr_1.3.1 tidyr_1.0.2 tibble_3.0.1
[13] ggplot2_3.3.0 tidyverse_1.3.0 imbalance_1.0.2.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.4.6 raster_3.1-5 xml2_1.3.1 magrittr_1.5 MASS_7.3-51.5
[6] splines_3.6.3 hms_0.5.3 rvest_0.3.5 tidyselect_1.0.0 colorspace_1.4-1
[11] R6_2.4.1 rlang_0.4.5 foreach_1.5.0 fansi_0.4.1 rgdal_1.4-8
[16] parallel_3.6.3 broom_0.5.6 dismo_1.1-4 gower_0.2.1 dbplyr_1.4.3
[21] modelr_0.1.6 withr_2.2.0 spatial.tools_1.6.2 ellipsis_0.3.0 iterators_1.0.12
[26] class_7.3-15 recipes_0.1.10 abind_1.4-5 assertthat_0.2.1 lifecycle_0.2.0
[31] Matrix_1.2-18 haven_2.2.0 mmap_0.6-19 sp_1.4-1 compiler_3.6.3
[36] cellranger_1.1.0 pillar_1.4.3 scales_1.1.0 backports_1.1.6 generics_0.0.2
[41] stats4_3.6.3 lubridate_1.7.8 jsonlite_1.6.1 pkgconfig_2.0.3 smotefamily_1.3.1
[46] rstudioapi_0.11 doParallel_1.0.15 munsell_0.5.0 prodlim_2019.11.13 httr_1.4.1
[51] plyr_1.8.6 tools_3.6.3 grid_3.6.3 nnet_7.3-12 ipred_0.9-9
[56] nlme_3.1-144 timeDate_3043.102 data.table_1.12.8 gtable_0.3.0 DBI_1.1.0
[61] cli_2.0.2 readxl_1.3.1 yaml_2.2.1 survival_3.1-12 crayon_1.3.4
[66] lava_1.6.7 reshape2_1.4.4 ModelMetrics_1.2.2.2 codetools_0.2-16 fs_1.4.1
[71] vctrs_0.2.4 rpart_4.1-15 glue_1.4.0 reprex_0.3.0 stringi_1.4.6


ONECLASS_ERROR.zip

pablo-baeza commented 4 years ago

Hi! I have the exact same error. Did you manage a way around this or are you simply not running the model in parallel?