Back to Multiple platform build/check report for BioC 3.6 |
|
This page was generated on 2018-04-12 13:20:24 -0400 (Thu, 12 Apr 2018).
Package 940/1472 | Hostname | OS / Arch | INSTALL | BUILD | CHECK | BUILD BIN | ||||||
netresponse 1.38.0 Leo Lahti
| malbec1 | Linux (Ubuntu 16.04.1 LTS) / x86_64 | NotNeeded | OK | WARNINGS | |||||||
tokay1 | Windows Server 2012 R2 Standard / x64 | NotNeeded | OK | [ WARNINGS ] | OK | |||||||
veracruz1 | OS X 10.11.6 El Capitan / x86_64 | NotNeeded | OK | WARNINGS | OK |
Package: netresponse |
Version: 1.38.0 |
Command: rm -rf netresponse.buildbin-libdir netresponse.Rcheck && mkdir netresponse.buildbin-libdir netresponse.Rcheck && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD INSTALL --build --merge-multiarch --library=netresponse.buildbin-libdir netresponse_1.38.0.tar.gz >netresponse.Rcheck\00install.out 2>&1 && cp netresponse.Rcheck\00install.out netresponse-install.out && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD check --library=netresponse.buildbin-libdir --install="check:netresponse-install.out" --force-multiarch --no-vignettes --timings netresponse_1.38.0.tar.gz |
StartedAt: 2018-04-12 01:49:06 -0400 (Thu, 12 Apr 2018) |
EndedAt: 2018-04-12 01:55:41 -0400 (Thu, 12 Apr 2018) |
EllapsedTime: 395.0 seconds |
RetCode: 0 |
Status: WARNINGS |
CheckDir: netresponse.Rcheck |
Warnings: 1 |
############################################################################## ############################################################################## ### ### Running command: ### ### rm -rf netresponse.buildbin-libdir netresponse.Rcheck && mkdir netresponse.buildbin-libdir netresponse.Rcheck && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD INSTALL --build --merge-multiarch --library=netresponse.buildbin-libdir netresponse_1.38.0.tar.gz >netresponse.Rcheck\00install.out 2>&1 && cp netresponse.Rcheck\00install.out netresponse-install.out && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD check --library=netresponse.buildbin-libdir --install="check:netresponse-install.out" --force-multiarch --no-vignettes --timings netresponse_1.38.0.tar.gz ### ############################################################################## ############################################################################## * using log directory 'C:/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.Rcheck' * using R version 3.4.4 (2018-03-15) * using platform: x86_64-w64-mingw32 (64-bit) * using session charset: ISO8859-1 * using option '--no-vignettes' * checking for file 'netresponse/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'netresponse' version '1.38.0' * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'netresponse' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * loading checks for arch 'i386' ** checking whether the package can be loaded ... OK ** checking whether the package can be loaded with stated dependencies ... OK ** checking whether the package can be unloaded cleanly ... OK ** checking whether the namespace can be loaded with stated dependencies ... OK ** checking whether the namespace can be unloaded cleanly ... OK ** checking loading without being on the library search path ... OK * loading checks for arch 'x64' ** checking whether the package can be loaded ... OK ** checking whether the package can be loaded with stated dependencies ... OK ** checking whether the package can be unloaded cleanly ... OK ** checking whether the namespace can be loaded with stated dependencies ... OK ** checking whether the namespace can be unloaded cleanly ... OK ** checking loading without being on the library search path ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking compiled code ... NOTE Note: information on .o files for i386 is not available Note: information on .o files for x64 is not available File 'C:/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.buildbin-libdir/netresponse/libs/i386/netresponse.dll': Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran) Found 'rand', possibly from 'rand' (C) Found 'srand', possibly from 'srand' (C) Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system RNGs. The detected symbols are linked into the code but might come from libraries and not actually be called. See 'Writing portable packages' in the 'Writing R Extensions' manual. * checking files in 'vignettes' ... WARNING Files in the 'vignettes' directory but no files in 'inst/doc': 'NetResponse.Rmd', 'NetResponse.md', 'TODO/TODO.Rmd', 'fig/NetResponse2-1.png', 'fig/NetResponse2b-1.png', 'fig/NetResponse3-1.png', 'fig/NetResponse4-1.png', 'fig/NetResponse5-1.png', 'fig/NetResponse7-1.png', 'fig/vdp-1.png', 'main.R', 'netresponse.bib', 'netresponse.pdf' Package has no Sweave vignette sources and no VignetteBuilder field. * checking examples ... ** running examples for arch 'i386' ... OK Examples with CPU or elapsed time > 5s user system elapsed ICMg.combined.sampler 37.36 0.02 37.38 ** running examples for arch 'x64' ... OK Examples with CPU or elapsed time > 5s user system elapsed ICMg.combined.sampler 38.36 0.07 38.47 * checking for unstated dependencies in 'tests' ... OK * checking tests ... ** running tests for arch 'i386' ... Running 'ICMg.test.R' Running 'bicmixture.R' Running 'mixture.model.test.R' Running 'mixture.model.test.multimodal.R' Running 'mixture.model.test.singlemode.R' Running 'timing.R' Running 'toydata2.R' Running 'validate.netresponse.R' Running 'validate.pca.basis.R' Running 'vdpmixture.R' OK ** running tests for arch 'x64' ... Running 'ICMg.test.R' Running 'bicmixture.R' Running 'mixture.model.test.R' Running 'mixture.model.test.multimodal.R' Running 'mixture.model.test.singlemode.R' Running 'timing.R' Running 'toydata2.R' Running 'validate.netresponse.R' Running 'validate.pca.basis.R' Running 'vdpmixture.R' OK * checking PDF version of manual ... OK * DONE Status: 1 WARNING, 1 NOTE See 'C:/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.Rcheck/00check.log' for details.
netresponse.Rcheck/00install.out
install for i386 * installing *source* package 'netresponse' ... ** libs C:/Rtools/mingw_32/bin/gcc -I"C:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/include" -DNDEBUG -I"C:/local323/include" -O3 -Wall -std=gnu99 -mtune=generic -c netresponse.c -o netresponse.o netresponse.c: In function 'mHPpost': netresponse.c:264:15: warning: unused variable 'prior_fields' [-Wunused-variable] const char *prior_fields[]={"Mumu","S2mu", ^ netresponse.c: In function 'vdp_mk_hp_posterior': netresponse.c:210:3: warning: 'U_hat_table' may be used uninitialized in this function [-Wmaybe-uninitialized] update_centroids(datalen, ncentroids, dim1, dim2, ^ netresponse.c:210:3: warning: 'data2_int' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c: In function 'mLogLambda': netresponse.c:713:3: warning: 'U_p' may be used uninitialized in this function [-Wmaybe-uninitialized] vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde, ^ netresponse.c:713:3: warning: 'KsiBeta' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'KsiAlpha' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'BetaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'AlphaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mutilde' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mubar' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'S2mu' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mumu' may be used uninitialized in this function [-Wmaybe-uninitialized] C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o netresponse.dll tmp.def netresponse.o -LC:/local323/lib/i386 -LC:/local323/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/bin/i386 -lR installing to C:/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.buildbin-libdir/netresponse/libs/i386 ** R ** data ** inst ** preparing package for lazy loading ** help *** installing help indices converting help for package 'netresponse' finding HTML links ... done ICMg.combined.sampler html ICMg.get.comp.memberships html ICMg.links.sampler html NetResponseModel-class html P.S html P.Sr html P.r.s html P.rS html P.rs.joint html P.rs.joint.individual html P.s.individual html P.s.r html PlotMixture html PlotMixtureBivariate html PlotMixtureMultivariate html PlotMixtureMultivariate.deprecated html PlotMixtureUnivariate html add.ellipse html bic.mixture html bic.mixture.multivariate html bic.mixture.univariate html bic.select.best.mode html centerData html check.matrix html check.network html continuous.responses html detect.responses html dna html enrichment.list.factor html enrichment.list.factor.minimal html factor.responses html factor.responses.minimal html filter.netw html filter.network html find.similar.features html generate.toydata html get.dat-NetResponseModel-method html get.mis html get.model.parameters html get.subnets-NetResponseModel-method html getqofz-NetResponseModel-method html independent.models html list.responses.continuous.multi html list.responses.continuous.single html list.responses.factor html list.responses.factor.minimal html list.significant.responses html listify.groupings html mixture.model html model.stats html netresponse-package html order.responses html osmo html pick.model.pairs html pick.model.parameters html plotPCA html plot_associations html plot_data html plot_expression html plot_matrix html plot_response html plot_responses html plot_scale html plot_subnet html read.sif html remove.negative.edges html response.enrichment html response2sample html sample2response html set.breaks html toydata html update.model.pair html vdp.mixt html vectorize.groupings html write.netresponse.results html ** building package indices ** installing vignettes ** testing if installed package can be loaded In R CMD INSTALL install for x64 * installing *source* package 'netresponse' ... ** libs C:/Rtools/mingw_64/bin/gcc -I"C:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/include" -DNDEBUG -I"C:/local323/include" -O2 -Wall -std=gnu99 -mtune=generic -c netresponse.c -o netresponse.o netresponse.c: In function 'mHPpost': netresponse.c:264:15: warning: unused variable 'prior_fields' [-Wunused-variable] const char *prior_fields[]={"Mumu","S2mu", ^ netresponse.c: In function 'mLogLambda': netresponse.c:713:3: warning: 'U_p' may be used uninitialized in this function [-Wmaybe-uninitialized] vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde, ^ netresponse.c:713:3: warning: 'KsiBeta' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'KsiAlpha' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'BetaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'AlphaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mutilde' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mubar' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'S2mu' may be used uninitialized in this function [-Wmaybe-uninitialized] netresponse.c:713:3: warning: 'Mumu' may be used uninitialized in this function [-Wmaybe-uninitialized] C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o netresponse.dll tmp.def netresponse.o -LC:/local323/lib/x64 -LC:/local323/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/bin/x64 -lR installing to C:/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.buildbin-libdir/netresponse/libs/x64 ** testing if installed package can be loaded * MD5 sums packaged installation of 'netresponse' as netresponse_1.38.0.zip * DONE (netresponse) In R CMD INSTALL In R CMD INSTALL
netresponse.Rcheck/tests_i386/bicmixture.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla > # -> ainakin nopea check > > ####################################################################### > > # Generate random data from five Gaussians. > # Detect modes with vdp-gm. > # Plot data points and detected clusters with variance ellipses > > ####################################################################### > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R") > #source("˜/Rpackages/netresponse/netresponse/R/internals.R") > #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") > #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > ######### Generate DATA ############################################# > > # Generate Nc components from normal-inverseGamma prior > > set.seed(12346) > > dd <- 3 # Dimensionality of data > Nc <- 5 # Number of components > Ns <- 200 # Number of data points > sd0 <- 3 # component spread > rgam.shape = 2 # parameters for Gamma distribution > rgam.scale = 2 # parameters for Gamma distribution to define precisions > > > # Generate means and variances (covariance diagonals) for the components > component.means <- matrix(rnorm(Nc*dd, mean = 0, sd = sd0), nrow = Nc, ncol = dd) > component.vars <- matrix(1/rgamma(Nc*dd, shape = rgam.shape, scale = rgam.scale), + nrow = Nc, ncol = dd) > component.sds <- sqrt(component.vars) > > > # Size for each component -> sample randomly for each data point from uniform distr. > # i.e. cluster assignments > sample2comp <- sample.int(Nc, Ns, replace = TRUE) > > D <- array(NA, dim = c(Ns, dd)) > for (i in 1:Ns) { + # component identity of this sample + ci <- sample2comp[[i]] + cm <- component.means[ci,] + csd <- component.sds[ci,] + D[i,] <- rnorm(dd, mean = cm, sd = csd) + } > > > ###################################################################### > > # Fit mixture model > out <- mixture.model(D, mixture.method = "bic") > > # FIXME rowmeans(qofz) is constant but not 1 > #qofz <- P.r.s(t(D), list(mu = out$mu, sd = out$sd, w = out$w), log = FALSE) > > ############################################################ > > # Compare input data and results > > ord.out <- order(out$mu[,1]) > ord.in <- order(component.means[,1]) > > means.out <- out$mu[ord.out,] > means.in <- component.means[ord.in,] > > # Cluster stds and variances > sds.out <- out$sd[ord.out,] > sds.in <- sqrt(component.vars[ord.in,]) > > # ----------------------------------------------------------- > > vars.out <- sds.out^2 > vars.in <- sds.in^2 > > # Check correspondence between input and output > if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } > > # Plot results (assuming 2D) > > ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) > > plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) > for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } > for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } > > ###################################################### > > #for (ci in 1:nrow(means.out)) { > # points(means.out[ci,1], means.out[ci,2], col = "red", pch = 19) > # el <- ellipse(matrix(c(vars.out[ci,1],0,0,vars.out[ci,2]),2), centre = means.out[ci,]) > # lines(el, col = "red") > #} > > #for (ci in 1:nrow(means.in)) { > # points(means.in[ci,1], means.in[ci,2], col = "blue", pch = 19) > # el <- ellipse(matrix(c(vars.in[ci,1],0,0,vars.in[ci,2]),2), centre = means.in[ci,]) > # lines(el, col = "blue") > #} > > > > > > > proc.time() user system elapsed 2.50 0.14 2.62 |
netresponse.Rcheck/tests_x64/bicmixture.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla > # -> ainakin nopea check > > ####################################################################### > > # Generate random data from five Gaussians. > # Detect modes with vdp-gm. > # Plot data points and detected clusters with variance ellipses > > ####################################################################### > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R") > #source("˜/Rpackages/netresponse/netresponse/R/internals.R") > #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") > #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > ######### Generate DATA ############################################# > > # Generate Nc components from normal-inverseGamma prior > > set.seed(12346) > > dd <- 3 # Dimensionality of data > Nc <- 5 # Number of components > Ns <- 200 # Number of data points > sd0 <- 3 # component spread > rgam.shape = 2 # parameters for Gamma distribution > rgam.scale = 2 # parameters for Gamma distribution to define precisions > > > # Generate means and variances (covariance diagonals) for the components > component.means <- matrix(rnorm(Nc*dd, mean = 0, sd = sd0), nrow = Nc, ncol = dd) > component.vars <- matrix(1/rgamma(Nc*dd, shape = rgam.shape, scale = rgam.scale), + nrow = Nc, ncol = dd) > component.sds <- sqrt(component.vars) > > > # Size for each component -> sample randomly for each data point from uniform distr. > # i.e. cluster assignments > sample2comp <- sample.int(Nc, Ns, replace = TRUE) > > D <- array(NA, dim = c(Ns, dd)) > for (i in 1:Ns) { + # component identity of this sample + ci <- sample2comp[[i]] + cm <- component.means[ci,] + csd <- component.sds[ci,] + D[i,] <- rnorm(dd, mean = cm, sd = csd) + } > > > ###################################################################### > > # Fit mixture model > out <- mixture.model(D, mixture.method = "bic") > > # FIXME rowmeans(qofz) is constant but not 1 > #qofz <- P.r.s(t(D), list(mu = out$mu, sd = out$sd, w = out$w), log = FALSE) > > ############################################################ > > # Compare input data and results > > ord.out <- order(out$mu[,1]) > ord.in <- order(component.means[,1]) > > means.out <- out$mu[ord.out,] > means.in <- component.means[ord.in,] > > # Cluster stds and variances > sds.out <- out$sd[ord.out,] > sds.in <- sqrt(component.vars[ord.in,]) > > # ----------------------------------------------------------- > > vars.out <- sds.out^2 > vars.in <- sds.in^2 > > # Check correspondence between input and output > if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } > > # Plot results (assuming 2D) > > ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) > > plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) > for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } > for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } > > ###################################################### > > #for (ci in 1:nrow(means.out)) { > # points(means.out[ci,1], means.out[ci,2], col = "red", pch = 19) > # el <- ellipse(matrix(c(vars.out[ci,1],0,0,vars.out[ci,2]),2), centre = means.out[ci,]) > # lines(el, col = "red") > #} > > #for (ci in 1:nrow(means.in)) { > # points(means.in[ci,1], means.in[ci,2], col = "blue", pch = 19) > # el <- ellipse(matrix(c(vars.in[ci,1],0,0,vars.in[ci,2]),2), centre = means.in[ci,]) > # lines(el, col = "blue") > #} > > > > > > > proc.time() user system elapsed 2.81 0.06 2.86 |
netresponse.Rcheck/tests_i386/ICMg.test.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Test script for the ICMg method > > # Load the package > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > data(osmo) # Load data > > # Set parameters > C.boost = 1 > alpha = 10 > beta = 0.01 > B.num = 10 > B.size = 10 > S.num = 10 > S.size = 10 > C = 24 > pm0 = 0 > V0 = 1 > V = 0.1 > > # Run combined ICMg sampler > res = ICMg.combined.sampler(osmo$ppi, osmo$exp, C, alpha, beta, pm0, V0, V, B.num, B.size, S.num, S.size, C.boost) Sampling ICMg2... nodes:10250links:1711observations:133components:24alpha:10beta:0.01 Sampling200iterationcs Burnin iterations:100 I: 0 n(z):441431447428422433394441412416423447466404421413418459403448413412440418 m(z):708375888567647574837074796269657972725161697153 I:10 convL:-0.487354478124194n(z):2993022744363004754681515302275273427648428425391837419272256249220402357 convN:-0.00691870302404143m(z):657141763986961725947378913051877675595172453651100 I:20 convL:-0.412036780783418n(z):2163622504372343705371821346212253453789383476331843386221209160172434355 convN:-0.00456299940829521m(z):606955674298100171534741881345187817063466945385383 I:30 convL:-0.373428717995942n(z):1993362333421964155021878348216219418944335469341977320253267133142453314 convN:-0.00343197847298687m(z):596856664795100171544941891354988816863457047345383 I:40 convL:-0.356540845973261n(z):23533720230417141050717793332162543771042345508346973380278252122141465273 convN:-0.000516912198213199m(z):596856674795100172544941881344988806864457047345383 I:50 convL:-0.359355923513465n(z):21932124526118437851817623522132534151093324572332972381277221146120429262 convN:-0.000378224972719905m(z):596856674795100172544941881344988806864457047345383 I:60 convL:-0.350086760932994n(z):20931623123018037746417543831982594011185365563345944353288255142132425251 convN:-0.00336917451893505m(z):596856664796100171544941881345088796864457048345383 I:70 convL:-0.347189646479549n(z):22832824521516039948917533581902323951219321585320935344283226175133426291 convN:-0.000811319222146076m(z):596856674796100171544941881344988796864457048345383 I:80 convL:-0.331268502357072n(z):22831425720618238643217063541912084221260351660332898331269251194115445258 convN:-0.00162302116187277m(z):596856684796100171544941881344987796864467048345382 I:90 convL:-0.338549832267903n(z):19932727721314938943617153461672414071309299655337951395238250136105434275 convN:-0.00400944249224796m(z):596856674796100170544941881344987796964477047345383 I:100 convL:-0.338301764477577n(z):19529724020219036048116833501652494041313309679339944329273231162113428314 convN:-0.00149089155103904m(z):596856674796100171544941881344988796964467046345383 Sample iterations:100 I:110 convL:-0.337280941705545n(z):2583052402131703784721657339174235409136125973034494535325719915277428295 convN:-0.0046435170062665m(z):596856674796100171544941881344988806963477045345383 I:120 convL:-0.345341572525645n(z):2372822472152123664751595330180227408142125167833699333425021413886446329 convN:-0.0032235760486957m(z):596856674796100170544941881344988796964477046345383 I:130 convL:-0.331569964423222n(z):24329824820319635146415933531872174061399248750356952325297197144104422297 convN:-0.00173503361253582m(z):596855654796100170544941881345189816963467046345383 I:140 convL:-0.324567163198469n(z):21930124419816136051015963181892233841464285707350940315299214129114425305 convN:-0.00323235768570436m(z):596855664796100171544941881345187816963467047345283 I:150 convL:-0.338335717841359n(z):2193042312211683454831565304187195395150030969235791730937122014493430291 convN:-0.00227993227233253m(z):596856654796100170544941881345187806963477047345383 I:160 convL:-0.333067407493059n(z):2393002271961693344791609326190188393151828168236188429836522016697423305 convN:-0.00258290086778101m(z):596856674796100170544941881344987806963477047345383 I:170 convL:-0.333142770653632n(z):2252912372022093474631540331192201399152828970337389729533522218487414286 convN:-0.00130920333946646m(z):596856674795100169544945881324987816963467047345383 I:180 convL:-0.327787661764565n(z):20231324618417735052315573431922313961528290686350827286364233167102422281 convN:-0.00318767060244094m(z):597056674796100171544946881314983796764487047345383 I:190 convL:-0.348701916923241n(z):2172932511931953844951618331156215405148928466332185728836322117886441306 convN:-0.00408317415333799m(z):596856674895100170544846881324983816865477047345383 I:200 convL:-0.318185957622917n(z):21829624517517434753216133331792294161539252641335880251383220174100428290 convN:-0.000364257231274468m(z):597056674795100170544946881324982806964477047345383 DONE > > # Compute component membership probabilities for the data points > res$comp.memb <- ICMg.get.comp.memberships(osmo$ppi, res) > > # Compute (hard) clustering for nodes > res$clustering <- apply(res$comp.memb, 2, which.max) > > proc.time() user system elapsed 9.60 0.14 9.75 |
netresponse.Rcheck/tests_x64/ICMg.test.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Test script for the ICMg method > > # Load the package > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > data(osmo) # Load data > > # Set parameters > C.boost = 1 > alpha = 10 > beta = 0.01 > B.num = 10 > B.size = 10 > S.num = 10 > S.size = 10 > C = 24 > pm0 = 0 > V0 = 1 > V = 0.1 > > # Run combined ICMg sampler > res = ICMg.combined.sampler(osmo$ppi, osmo$exp, C, alpha, beta, pm0, V0, V, B.num, B.size, S.num, S.size, C.boost) Sampling ICMg2... nodes:10250links:1711observations:133components:24alpha:10beta:0.01 Sampling200iterationcs Burnin iterations:100 I: 0 n(z):420406398439406454426413445414444459403437415428405410441428418438451452 m(z):716882897381666968816468745176686880557786478366 I:10 convL:-0.498816236826681n(z):1922565002984726332552883813385201415383342281216639330238352694545372310 convN:-0.00782508689692558m(z):3767759512911143483161961694927604212860289892554070 I:20 convL:-0.427569977915425n(z):1742615032824766922442983032526171452391304313247745369170271763513322288 convN:-0.00482033080952842m(z):3671749713211142443358881715426584112960289089565271 I:30 convL:-0.417862947054813n(z):1702575182584526512433672492376251344365334344265904498199260745496234235 convN:-Infm(z):3970749712711242473359881695425594112759289189565570 I:40 convL:-0.394756741684123n(z):1552794382214436692433532352406121362355288321281989583193246779465249251 convN:-0.00431395209499312m(z):4069739712611342453155891695625613912859288992605570 I:50 convL:-0.381292910385305n(z):15624646022545368924134125824855713483762522682821124567189263732497254224 convN:-0.0051283476770799m(z):3967749612611042473254891715624663912759299289605469 I:60 convL:-0.38660831759509n(z):16226344020444367720837527823657811914272022253241244575158241851478229241 convN:-0.00554491342591226m(z):3968729812611142463254891695624663913159299187605469 I:70 convL:-0.376903190126414n(z):16422542422338267222037029320664210674252402313231272584164251926485212249 convN:-0.00631703709100339m(z):3968739712711142473254891705625663912759299087615469 I:80 convL:-0.36462063400233n(z):14624141922039865920437833921657110934512402212921262596189262931484227211 convN:-0.00276206090469433m(z):3968719712611142473255891695524663912859309190605469 I:90 convL:-0.355066435489032n(z):17220440421637368219138234521261810624202242612991351644168255895470206196 convN:-0.00547871028135296m(z):3867749712611042473254891695625663812759309288615569 I:100 convL:-0.343315023100635n(z):16521437821439174217035734021862810564282352272761321659173287904447217203 convN:-0.00268919407056041m(z):3867729712611242473254891695624663912758299389615470 Sample iterations:100 I:110 convL:-0.348522995808042n(z):17018937324033875117936233323360510224022322752901359625132276967464222211 convN:-0.00344744166878074m(z):3867729712611242473255891695524663912858299389605470 I:120 convL:-0.337678450717407n(z):1511813992413467121693773402616629793942082782791400677111272938459221195 convN:-0.00371549824553026m(z):3761729912611142473655891705524663912859329189605469 I:130 convL:-0.321904426341795n(z):15019136121332272616936938225360710064062172912891410680123239913483227223 convN:-0.00337570521879877m(z):38607210012911140473755891685525683912859328789605469 I:140 convL:-0.333457413593653n(z):1571744011913007381643704052395779353892023012821489729121253927453214239 convN:-0.00582250323732001m(z):38607110112911140473754891675624683913159328787615469 I:150 convL:-0.331082755268254n(z):168195373197319735163370377223602954384195322303149472496238924451237206 convN:-0.00446453467987125m(z):39607210012811240473754891675625683812859328790605469 I:160 convL:-0.338124679591489n(z):180200349230342692186380384258593956377186347310151170383207932450200194 convN:-0.00192793573396461m(z):38607110112911140473754891675624683912859328791605469 I:170 convL:-0.353930861866247n(z):1672003432363907061833763722936129573402033252601482712109194948443215184 convN:-0.00476351729744002m(z):39606610012811040473755901675525683912958328794625469 I:180 convL:-0.337548882611518n(z):179194325242372747189365369294595887303198311292153875998204940445232172 convN:-0.00289301151857487m(z):39606510112711341473755891685224693913059308796615369 I:190 convL:-0.340825510805878n(z):1712033512053297481883633712776149363132053282821486752112211944451218192 convN:-0.00226106238956246m(z):38606510112911440473755891675224693813159308796615369 I:200 convL:-0.341448108422565n(z):1811843812013247681703543792786319323151923432621553720126200872468210206 convN:-0.00116194907178223m(z):38606510012911340473755891675225693913159308796615369 DONE > > # Compute component membership probabilities for the data points > res$comp.memb <- ICMg.get.comp.memberships(osmo$ppi, res) > > # Compute (hard) clustering for nodes > res$clustering <- apply(res$comp.memb, 2, which.max) > > proc.time() user system elapsed 9.95 0.14 10.07 |
netresponse.Rcheck/tests_i386/mixture.model.test.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Validate mixture models > > # Generate random data from five Gaussians. > # Detect modes > # Plot data points and detected clusters > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = TRUE); for (f in fs) {source(f)}; dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > ######### Generate DATA ####################### > > res <- generate.toydata() > D <- res$data > component.means <- res$means > component.sds <- res$sds > sample2comp <- res$sample2comp > > ###################################################################### > > par(mfrow = c(2,1)) > > for (mm in c("vdp", "bic")) { + + # Fit nonparametric Gaussian mixture model + #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") + out <- mixture.model(D, mixture.method = mm, max.responses = 10, pca.basis = FALSE) + + ############################################################ + + # Compare input data and results + + ord.out <- order(out$mu[,1]) + ord.in <- order(component.means[,1]) + + means.out <- out$mu[ord.out,] + means.in <- component.means[ord.in,] + + # Cluster stds and variances + sds.out <- out$sd[ord.out,] + vars.out <- sds.out^2 + + sds.in <- component.sds[ord.in,] + vars.in <- sds.in^2 + + # Check correspondence between input and output + if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } + + # Plot results (assuming 2D) + ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) + + real.modes <- sample2comp + obs.modes <- apply(out$qofz, 1, which.max) + + # plot(D, pch = 20, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran) + plot(D, pch = real.modes, col = obs.modes, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran) + for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } + for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } + + } > > > proc.time() user system elapsed 2.76 0.15 2.90 |
netresponse.Rcheck/tests_x64/mixture.model.test.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Validate mixture models > > # Generate random data from five Gaussians. > # Detect modes > # Plot data points and detected clusters > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = TRUE); for (f in fs) {source(f)}; dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > ######### Generate DATA ####################### > > res <- generate.toydata() > D <- res$data > component.means <- res$means > component.sds <- res$sds > sample2comp <- res$sample2comp > > ###################################################################### > > par(mfrow = c(2,1)) > > for (mm in c("vdp", "bic")) { + + # Fit nonparametric Gaussian mixture model + #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") + out <- mixture.model(D, mixture.method = mm, max.responses = 10, pca.basis = FALSE) + + ############################################################ + + # Compare input data and results + + ord.out <- order(out$mu[,1]) + ord.in <- order(component.means[,1]) + + means.out <- out$mu[ord.out,] + means.in <- component.means[ord.in,] + + # Cluster stds and variances + sds.out <- out$sd[ord.out,] + vars.out <- sds.out^2 + + sds.in <- component.sds[ord.in,] + vars.in <- sds.in^2 + + # Check correspondence between input and output + if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } + + # Plot results (assuming 2D) + ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) + + real.modes <- sample2comp + obs.modes <- apply(out$qofz, 1, which.max) + + # plot(D, pch = 20, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran) + plot(D, pch = real.modes, col = obs.modes, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran) + for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } + for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } + + } > > > proc.time() user system elapsed 2.89 0.09 2.96 |
netresponse.Rcheck/tests_i386/mixture.model.test.multimodal.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > # Three MODES > > # set.seed(34884) > set.seed(3488400) > > Ns <- 200 > Nd <- 2 > > D3 <- rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 3), ncol = Nd), + cbind(rnorm(Ns, mean = -3), rnorm(Ns, mean = 3)) + ) > > #X11() > par(mfrow = c(2,2)) > for (mm in c("vdp", "bic")) { + for (pp in c(FALSE, TRUE)) { + + # Fit nonparametric Gaussian mixture model + out <- mixture.model(D3, mixture.method = mm, pca.basis = pp) + plot(D3, col = apply(out$qofz, 1, which.max), main = paste(mm, "/ pca:", pp)) + + } + } > > # VDP is less sensitive than BIC in detecting Gaussian modes (more > # separation between the clusters needed) > > # pca.basis option is less important for sensitive detection but > # it will help to avoid overfitting to unimodal features that > # are not parallel to the axes (unimodal distribution often becomes > # splitted in two or more clusters in these cases) > > > proc.time() user system elapsed 6.37 0.12 6.50 |
netresponse.Rcheck/tests_x64/mixture.model.test.multimodal.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > # Three MODES > > # set.seed(34884) > set.seed(3488400) > > Ns <- 200 > Nd <- 2 > > D3 <- rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 3), ncol = Nd), + cbind(rnorm(Ns, mean = -3), rnorm(Ns, mean = 3)) + ) > > #X11() > par(mfrow = c(2,2)) > for (mm in c("vdp", "bic")) { + for (pp in c(FALSE, TRUE)) { + + # Fit nonparametric Gaussian mixture model + out <- mixture.model(D3, mixture.method = mm, pca.basis = pp) + plot(D3, col = apply(out$qofz, 1, which.max), main = paste(mm, "/ pca:", pp)) + + } + } > > # VDP is less sensitive than BIC in detecting Gaussian modes (more > # separation between the clusters needed) > > # pca.basis option is less important for sensitive detection but > # it will help to avoid overfitting to unimodal features that > # are not parallel to the axes (unimodal distribution often becomes > # splitted in two or more clusters in these cases) > > > proc.time() user system elapsed 4.73 0.17 4.90 |
netresponse.Rcheck/tests_i386/mixture.model.test.singlemode.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + + library(netresponse) + + # SINGLE MODE + + # Produce test data that has full covariance + # It is expected that + # pca.basis = FALSE splits Gaussian with full covariance into two modes + # pca.basis = TRUE should detect just a single mode + + Ns <- 200 + Nd <- 2 + k <- 1.5 + + D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,k), c(k,1)) + + par(mfrow = c(2,2)) + for (mm in c("vdp", "bic")) { + for (pp in c(FALSE, TRUE)) { + + # Fit nonparametric Gaussian mixture model + out <- mixture.model(D2, mixture.method = mm, pca.basis = pp) + plot(D2, col = apply(out$qofz, 1, which.max), main = paste("mm:" , mm, "/ pp:", pp)) + + } + } + + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > proc.time() user system elapsed 3.01 0.18 3.18 |
netresponse.Rcheck/tests_x64/mixture.model.test.singlemode.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + + library(netresponse) + + # SINGLE MODE + + # Produce test data that has full covariance + # It is expected that + # pca.basis = FALSE splits Gaussian with full covariance into two modes + # pca.basis = TRUE should detect just a single mode + + Ns <- 200 + Nd <- 2 + k <- 1.5 + + D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,k), c(k,1)) + + par(mfrow = c(2,2)) + for (mm in c("vdp", "bic")) { + for (pp in c(FALSE, TRUE)) { + + # Fit nonparametric Gaussian mixture model + out <- mixture.model(D2, mixture.method = mm, pca.basis = pp) + plot(D2, col = apply(out$qofz, 1, which.max), main = paste("mm:" , mm, "/ pp:", pp)) + + } + } + + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > > proc.time() user system elapsed 3.17 0.20 3.37 |
netresponse.Rcheck/tests_i386/timing.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > # Play with different options and check their effect on running times for bic and vdp > > skip <- TRUE > > if (!skip) { + + Ns <- 100 + Nd <- 2 + + set.seed(3488400) + + D <- cbind( + + rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd), + cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3)) + ), + + rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd), + cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3)) + ) + ) + + rownames(D) <- paste("R", 1:nrow(D), sep = "-") + colnames(D) <- paste("C", 1:ncol(D), sep = "-") + + ts <- c() + for (mm in c("bic", "vdp")) { + + + # NOTE: no PCA basis needed with mixture.method = "bic" + tt <- system.time(detect.responses(D, verbose = TRUE, max.responses = 5, + mixture.method = mm, information.criterion = "BIC", + merging.threshold = 0, bic.threshold = 0, pca.basis = TRUE)) + + print(paste(mm, ":", round(tt[["elapsed"]], 3))) + ts[[mm]] <- tt[["elapsed"]] + } + + print(paste(names(ts)[[1]], "/", names(ts)[[2]], ": ", round(ts[[1]]/ts[[2]], 3))) + + } > > # -> VDP is much faster when sample sizes increase > # 1000 samples -> 25-fold speedup with VDP > > > > proc.time() user system elapsed 0.20 0.03 0.23 |
netresponse.Rcheck/tests_x64/timing.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > # Play with different options and check their effect on running times for bic and vdp > > skip <- TRUE > > if (!skip) { + + Ns <- 100 + Nd <- 2 + + set.seed(3488400) + + D <- cbind( + + rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd), + cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3)) + ), + + rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), + matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd), + cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3)) + ) + ) + + rownames(D) <- paste("R", 1:nrow(D), sep = "-") + colnames(D) <- paste("C", 1:ncol(D), sep = "-") + + ts <- c() + for (mm in c("bic", "vdp")) { + + + # NOTE: no PCA basis needed with mixture.method = "bic" + tt <- system.time(detect.responses(D, verbose = TRUE, max.responses = 5, + mixture.method = mm, information.criterion = "BIC", + merging.threshold = 0, bic.threshold = 0, pca.basis = TRUE)) + + print(paste(mm, ":", round(tt[["elapsed"]], 3))) + ts[[mm]] <- tt[["elapsed"]] + } + + print(paste(names(ts)[[1]], "/", names(ts)[[2]], ": ", round(ts[[1]]/ts[[2]], 3))) + + } > > # -> VDP is much faster when sample sizes increase > # 1000 samples -> 25-fold speedup with VDP > > > > proc.time() user system elapsed 0.12 0.04 0.17 |
netresponse.Rcheck/tests_i386/toydata2.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Generate Nc components from normal-inverseGamma prior > > set.seed(12346) > > Ns <- 300 > Nd <- 2 > > # Isotropic cloud > D1 <- matrix(rnorm(Ns*Nd), ncol = Nd) > > # Single diagonal mode > D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,2), c(2,1)) > > # Two isotropic modes > D3 <- rbind(matrix(rnorm(Ns/2*Nd), ncol = Nd), matrix(rnorm(Ns/2*Nd, mean = 3), ncol = Nd)) > D <- cbind(D1, D2, D3) > > colnames(D) <- paste("Feature-", 1:ncol(D), sep = "") > rownames(D) <- paste("Sample-", 1:nrow(D), sep = "") > > > proc.time() user system elapsed 0.15 0.00 0.14 |
netresponse.Rcheck/tests_x64/toydata2.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Generate Nc components from normal-inverseGamma prior > > set.seed(12346) > > Ns <- 300 > Nd <- 2 > > # Isotropic cloud > D1 <- matrix(rnorm(Ns*Nd), ncol = Nd) > > # Single diagonal mode > D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,2), c(2,1)) > > # Two isotropic modes > D3 <- rbind(matrix(rnorm(Ns/2*Nd), ncol = Nd), matrix(rnorm(Ns/2*Nd, mean = 3), ncol = Nd)) > D <- cbind(D1, D2, D3) > > colnames(D) <- paste("Feature-", 1:ncol(D), sep = "") > rownames(D) <- paste("Sample-", 1:nrow(D), sep = "") > > > proc.time() user system elapsed 0.15 0.03 0.17 |
netresponse.Rcheck/tests_i386/validate.netresponse.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + + # 2. netresponse test + # test later with varying parameters + + # Load the package + library(netresponse) + #load("../data/toydata.rda") + fs <- list.files("../R/", full.names = TRUE); for (f in fs) {source(f)}; + + data(toydata) + + D <- toydata$emat + netw <- toydata$netw + + # The toy data is random data with 10 features (genes). + # The features + rf <- c(4, 5, 6) + #form a subnetwork with coherent responses + # with means + r1 <- c(0, 3, 0) + r2 <- c(-5, 0, 2) + r3 <- c(5, -3, -3) + mu.real <- rbind(r1, r2, r3) + # real weights + w.real <- c(70, 70, 60)/200 + # and unit variances + rv <- 1 + + # Fit the model + #res <- detect.responses(D, netw, verbose = TRUE, mc.cores = 2) + #res <- detect.responses(D, netw, verbose = TRUE, max.responses = 4) + + res <- detect.responses(D, netw, verbose = TRUE, max.responses = 3, mixture.method = "bic", information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE) + + print("OK") + + # Subnets (each is a list of nodes) + subnets <- get.subnets(res) + + # the correct subnet is retrieved in subnet number 2: + #> subnet[[2]] + #[1] "feat4" "feat5" "feat6" + + # how about responses + # Retrieve model for the subnetwork with lowest cost function value + # means, standard devations and weights for the components + if (!is.null(subnets)) { + m <- get.model.parameters(res, subnet.id = "Subnet-2") + + # order retrieved and real response means by the first feature + # (to ensure responses are listed in the same order) + # and compare deviation from correct solution + ord.obs <- order(m$mu[,1]) + ord.real <- order(mu.real[,1]) + + print(paste("Correlation between real and observed responses:", cor(as.vector(m$mu[ord.obs,]), as.vector(mu.real[ord.real,])))) + + # all real variances are 1, compare to observed ones + print(paste("Maximum deviation from real variances: ", max(abs(rv - range(m$sd))/rv))) + + # weights deviate somewhat, this is likely due to relatively small sample size + #print("Maximum deviation from real weights: ") + #print( (w.real[ord.real] - m$w[ord.obs])/w.real[ord.real]) + + print("estimated and real mean matrices") + print(m$mu[ord.obs,]) + print(mu.real[ord.real,]) + + } + + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 8 2 / 8 3 / 8 4 / 8 5 / 8 6 / 8 7 / 8 8 / 8 Compute cost for each variable Computing model for node 1 / 10 Computing model for node 2 / 10 Computing model for node 3 / 10 Computing model for node 4 / 10 Computing model for node 5 / 10 Computing model for node 6 / 10 Computing model for node 7 / 10 Computing model for node 8 / 10 Computing model for node 9 / 10 Computing model for node 10 / 10 independent models done Computing delta values for edge 1 / 29 Computing delta values for edge 2 / 29 Computing delta values for edge 3 / 29 Computing delta values for edge 4 / 29 Computing delta values for edge 5 / 29 Computing delta values for edge 6 / 29 Computing delta values for edge 7 / 29 Computing delta values for edge 8 / 29 Computing delta values for edge 9 / 29 Computing delta values for edge 10 / 29 Computing delta values for edge 11 / 29 Computing delta values for edge 12 / 29 Computing delta values for edge 13 / 29 Computing delta values for edge 14 / 29 Computing delta values for edge 15 / 29 Computing delta values for edge 16 / 29 Computing delta values for edge 17 / 29 Computing delta values for edge 18 / 29 Computing delta values for edge 19 / 29 Computing delta values for edge 20 / 29 Computing delta values for edge 21 / 29 Computing delta values for edge 22 / 29 Computing delta values for edge 23 / 29 Computing delta values for edge 24 / 29 Computing delta values for edge 25 / 29 Computing delta values for edge 26 / 29 Computing delta values for edge 27 / 29 Computing delta values for edge 28 / 29 Computing delta values for edge 29 / 29 Combining groups, 10 group(s) left... Combining groups, 9 group(s) left... Combining groups, 8 group(s) left... Combining groups, 7 group(s) left... Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... [1] "OK" [1] "Correlation between real and observed responses: 0.999117848017521" [1] "Maximum deviation from real variances: 0.0391530538149302" [1] "estimated and real mean matrices" [,1] [,2] [,3] [1,] -4.9334982 -0.1575946 2.1613225 [2,] -0.1299285 3.0047767 -0.1841669 [3,] 5.0738471 -2.9334877 -3.2217492 [,1] [,2] [,3] r2 -5 0 2 r1 0 3 0 r3 5 -3 -3 > > proc.time() user system elapsed 41.56 0.14 41.67 |
netresponse.Rcheck/tests_x64/validate.netresponse.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + + # 2. netresponse test + # test later with varying parameters + + # Load the package + library(netresponse) + #load("../data/toydata.rda") + fs <- list.files("../R/", full.names = TRUE); for (f in fs) {source(f)}; + + data(toydata) + + D <- toydata$emat + netw <- toydata$netw + + # The toy data is random data with 10 features (genes). + # The features + rf <- c(4, 5, 6) + #form a subnetwork with coherent responses + # with means + r1 <- c(0, 3, 0) + r2 <- c(-5, 0, 2) + r3 <- c(5, -3, -3) + mu.real <- rbind(r1, r2, r3) + # real weights + w.real <- c(70, 70, 60)/200 + # and unit variances + rv <- 1 + + # Fit the model + #res <- detect.responses(D, netw, verbose = TRUE, mc.cores = 2) + #res <- detect.responses(D, netw, verbose = TRUE, max.responses = 4) + + res <- detect.responses(D, netw, verbose = TRUE, max.responses = 3, mixture.method = "bic", information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE) + + print("OK") + + # Subnets (each is a list of nodes) + subnets <- get.subnets(res) + + # the correct subnet is retrieved in subnet number 2: + #> subnet[[2]] + #[1] "feat4" "feat5" "feat6" + + # how about responses + # Retrieve model for the subnetwork with lowest cost function value + # means, standard devations and weights for the components + if (!is.null(subnets)) { + m <- get.model.parameters(res, subnet.id = "Subnet-2") + + # order retrieved and real response means by the first feature + # (to ensure responses are listed in the same order) + # and compare deviation from correct solution + ord.obs <- order(m$mu[,1]) + ord.real <- order(mu.real[,1]) + + print(paste("Correlation between real and observed responses:", cor(as.vector(m$mu[ord.obs,]), as.vector(mu.real[ord.real,])))) + + # all real variances are 1, compare to observed ones + print(paste("Maximum deviation from real variances: ", max(abs(rv - range(m$sd))/rv))) + + # weights deviate somewhat, this is likely due to relatively small sample size + #print("Maximum deviation from real weights: ") + #print( (w.real[ord.real] - m$w[ord.obs])/w.real[ord.real]) + + print("estimated and real mean matrices") + print(m$mu[ord.obs,]) + print(mu.real[ord.real,]) + + } + + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 8 2 / 8 3 / 8 4 / 8 5 / 8 6 / 8 7 / 8 8 / 8 Compute cost for each variable Computing model for node 1 / 10 Computing model for node 2 / 10 Computing model for node 3 / 10 Computing model for node 4 / 10 Computing model for node 5 / 10 Computing model for node 6 / 10 Computing model for node 7 / 10 Computing model for node 8 / 10 Computing model for node 9 / 10 Computing model for node 10 / 10 independent models done Computing delta values for edge 1 / 29 Computing delta values for edge 2 / 29 Computing delta values for edge 3 / 29 Computing delta values for edge 4 / 29 Computing delta values for edge 5 / 29 Computing delta values for edge 6 / 29 Computing delta values for edge 7 / 29 Computing delta values for edge 8 / 29 Computing delta values for edge 9 / 29 Computing delta values for edge 10 / 29 Computing delta values for edge 11 / 29 Computing delta values for edge 12 / 29 Computing delta values for edge 13 / 29 Computing delta values for edge 14 / 29 Computing delta values for edge 15 / 29 Computing delta values for edge 16 / 29 Computing delta values for edge 17 / 29 Computing delta values for edge 18 / 29 Computing delta values for edge 19 / 29 Computing delta values for edge 20 / 29 Computing delta values for edge 21 / 29 Computing delta values for edge 22 / 29 Computing delta values for edge 23 / 29 Computing delta values for edge 24 / 29 Computing delta values for edge 25 / 29 Computing delta values for edge 26 / 29 Computing delta values for edge 27 / 29 Computing delta values for edge 28 / 29 Computing delta values for edge 29 / 29 Combining groups, 10 group(s) left... Combining groups, 9 group(s) left... Combining groups, 8 group(s) left... Combining groups, 7 group(s) left... Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... [1] "OK" [1] "Correlation between real and observed responses: 0.999117848017521" [1] "Maximum deviation from real variances: 0.0391530538149302" [1] "estimated and real mean matrices" [,1] [,2] [,3] [1,] -4.9334982 -0.1575946 2.1613225 [2,] -0.1299285 3.0047767 -0.1841669 [3,] 5.0738471 -2.9334877 -3.2217492 [,1] [,2] [,3] r2 -5 0 2 r1 0 3 0 r3 5 -3 -3 > > proc.time() user system elapsed 41.35 0.09 41.51 |
netresponse.Rcheck/tests_i386/validate.pca.basis.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + # Visualization + + library(netresponse) + + #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = T); for (f in fs) {source(f)} + + source("toydata2.R") + + # -------------------------------------------------------------------- + + set.seed(4243) + mixture.method <- "bic" + + # -------------------------------------------------------------------- + + res <- detect.responses(D, verbose = TRUE, max.responses = 10, + mixture.method = mixture.method, information.criterion = "BIC", + merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE) + + res.pca <- detect.responses(D, verbose = TRUE, max.responses = 10, mixture.method = mixture.method, information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = TRUE) + + # -------------------------------------------------------------------- + + k <- 1 + + # Incorrect VDP: two modes detected + # Correct BIC: single mode detected + subnet.id <- names(get.subnets(res))[[k]] + + # Correct: single mode detected (VDP & BIC) + subnet.id.pca <- names(get.subnets(res.pca))[[k]] + + # -------------------------------------------------------------------------------------------------- + + vis1 <- plot_responses(res, subnet.id, plot_mode = "pca", main = paste("NoPCA; NoDM")) + vis2 <- plot_responses(res, subnet.id, plot_mode = "pca", datamatrix = D, main = "NoPCA, DM") + vis3 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", main = "PCA, NoDM") + vis4 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", datamatrix = D, main = "PCA, DM") + + # With original data: VDP overlearns; BIC works; with full covariance data + # With PCA basis: modes detected ok with both VDP and BIC. + + # ------------------------------------------------------------------------ + + # TODO + # pca.plot(res, subnet.id) + # plot_subnet(res, subnet.id) + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 5 2 / 5 3 / 5 4 / 5 5 / 5 Compute cost for each variable Computing model for node 1 / 6 Computing model for node 2 / 6 Computing model for node 3 / 6 Computing model for node 4 / 6 Computing model for node 5 / 6 Computing model for node 6 / 6 independent models done Computing delta values for edge 1 / 15 Computing delta values for edge 2 / 15 Computing delta values for edge 3 / 15 Computing delta values for edge 4 / 15 Computing delta values for edge 5 / 15 Computing delta values for edge 6 / 15 Computing delta values for edge 7 / 15 Computing delta values for edge 8 / 15 Computing delta values for edge 9 / 15 Computing delta values for edge 10 / 15 Computing delta values for edge 11 / 15 Computing delta values for edge 12 / 15 Computing delta values for edge 13 / 15 Computing delta values for edge 14 / 15 Computing delta values for edge 15 / 15 Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... Combining groups, 3 group(s) left... convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 5 2 / 5 3 / 5 4 / 5 5 / 5 Compute cost for each variable Computing model for node 1 / 6 Computing model for node 2 / 6 Computing model for node 3 / 6 Computing model for node 4 / 6 Computing model for node 5 / 6 Computing model for node 6 / 6 independent models done Computing delta values for edge 1 / 15 Computing delta values for edge 2 / 15 Computing delta values for edge 3 / 15 Computing delta values for edge 4 / 15 Computing delta values for edge 5 / 15 Computing delta values for edge 6 / 15 Computing delta values for edge 7 / 15 Computing delta values for edge 8 / 15 Computing delta values for edge 9 / 15 Computing delta values for edge 10 / 15 Computing delta values for edge 11 / 15 Computing delta values for edge 12 / 15 Computing delta values for edge 13 / 15 Computing delta values for edge 14 / 15 Computing delta values for edge 15 / 15 Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... Combining groups, 3 group(s) left... Warning messages: 1: In check.network(network, datamatrix, verbose = verbose) : No network provided in function call: assuming fully connected nodes. 2: In check.network(network, datamatrix, verbose = verbose) : No network provided in function call: assuming fully connected nodes. > > proc.time() user system elapsed 28.51 0.12 28.62 |
netresponse.Rcheck/tests_x64/validate.pca.basis.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > skip <- FALSE > > if (!skip) { + # Visualization + + library(netresponse) + + #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = T); for (f in fs) {source(f)} + + source("toydata2.R") + + # -------------------------------------------------------------------- + + set.seed(4243) + mixture.method <- "bic" + + # -------------------------------------------------------------------- + + res <- detect.responses(D, verbose = TRUE, max.responses = 10, + mixture.method = mixture.method, information.criterion = "BIC", + merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE) + + res.pca <- detect.responses(D, verbose = TRUE, max.responses = 10, mixture.method = mixture.method, information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = TRUE) + + # -------------------------------------------------------------------- + + k <- 1 + + # Incorrect VDP: two modes detected + # Correct BIC: single mode detected + subnet.id <- names(get.subnets(res))[[k]] + + # Correct: single mode detected (VDP & BIC) + subnet.id.pca <- names(get.subnets(res.pca))[[k]] + + # -------------------------------------------------------------------------------------------------- + + vis1 <- plot_responses(res, subnet.id, plot_mode = "pca", main = paste("NoPCA; NoDM")) + vis2 <- plot_responses(res, subnet.id, plot_mode = "pca", datamatrix = D, main = "NoPCA, DM") + vis3 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", main = "PCA, NoDM") + vis4 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", datamatrix = D, main = "PCA, DM") + + # With original data: VDP overlearns; BIC works; with full covariance data + # With PCA basis: modes detected ok with both VDP and BIC. + + # ------------------------------------------------------------------------ + + # TODO + # pca.plot(res, subnet.id) + # plot_subnet(res, subnet.id) + } Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 5 2 / 5 3 / 5 4 / 5 5 / 5 Compute cost for each variable Computing model for node 1 / 6 Computing model for node 2 / 6 Computing model for node 3 / 6 Computing model for node 4 / 6 Computing model for node 5 / 6 Computing model for node 6 / 6 independent models done Computing delta values for edge 1 / 15 Computing delta values for edge 2 / 15 Computing delta values for edge 3 / 15 Computing delta values for edge 4 / 15 Computing delta values for edge 5 / 15 Computing delta values for edge 6 / 15 Computing delta values for edge 7 / 15 Computing delta values for edge 8 / 15 Computing delta values for edge 9 / 15 Computing delta values for edge 10 / 15 Computing delta values for edge 11 / 15 Computing delta values for edge 12 / 15 Computing delta values for edge 13 / 15 Computing delta values for edge 14 / 15 Computing delta values for edge 15 / 15 Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... Combining groups, 3 group(s) left... convert the network into edge matrix removing self-links matching the features between network and datamatrix Filter the network to only keep the edges with highest mutual information 1 / 5 2 / 5 3 / 5 4 / 5 5 / 5 Compute cost for each variable Computing model for node 1 / 6 Computing model for node 2 / 6 Computing model for node 3 / 6 Computing model for node 4 / 6 Computing model for node 5 / 6 Computing model for node 6 / 6 independent models done Computing delta values for edge 1 / 15 Computing delta values for edge 2 / 15 Computing delta values for edge 3 / 15 Computing delta values for edge 4 / 15 Computing delta values for edge 5 / 15 Computing delta values for edge 6 / 15 Computing delta values for edge 7 / 15 Computing delta values for edge 8 / 15 Computing delta values for edge 9 / 15 Computing delta values for edge 10 / 15 Computing delta values for edge 11 / 15 Computing delta values for edge 12 / 15 Computing delta values for edge 13 / 15 Computing delta values for edge 14 / 15 Computing delta values for edge 15 / 15 Combining groups, 6 group(s) left... Combining groups, 5 group(s) left... Combining groups, 4 group(s) left... Combining groups, 3 group(s) left... Warning messages: 1: In check.network(network, datamatrix, verbose = verbose) : No network provided in function call: assuming fully connected nodes. 2: In check.network(network, datamatrix, verbose = verbose) : No network provided in function call: assuming fully connected nodes. > > proc.time() user system elapsed 32.54 0.18 32.98 |
netresponse.Rcheck/tests_i386/vdpmixture.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla > # -> ainakin nopea check > > ####################################################################### > > # Generate random data from five Gaussians. > # Detect modes with vdp-gm. > # Plot data points and detected clusters with variance ellipses > > ####################################################################### > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R") > #source("˜/Rpackages/netresponse/netresponse/R/internals.R") > #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") > #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > > ######### Generate DATA ############################################# > > res <- generate.toydata() > D <- res$data > component.means <- res$means > component.sds <- res$sds > sample2comp <- res$sample2comp > > ###################################################################### > > # Fit nonparametric Gaussian mixture model > out <- vdp.mixt(D) > # out <- vdp.mixt(D, c.max = 3) # try with limited number of components -> OK > > ############################################################ > > # Compare input data and results > > ord.out <- order(out$posterior$centroids[,1]) > ord.in <- order(component.means[,1]) > > means.out <- out$posterior$centroids[ord.out,] > means.in <- component.means[ord.in,] > > # Cluster stds and variances > sds.out <- out$posterior$sds[ord.out,] > sds.in <- component.sds[ord.in,] > vars.out <- sds.out^2 > vars.in <- sds.in^2 > > # Check correspondence between input and output > if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } > > # Plot results (assuming 2D) > > ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) > > plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) > for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } > for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } > > > > proc.time() user system elapsed 2.57 0.03 2.62 |
netresponse.Rcheck/tests_x64/vdpmixture.Rout R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla > # -> ainakin nopea check > > ####################################################################### > > # Generate random data from five Gaussians. > # Detect modes with vdp-gm. > # Plot data points and detected clusters with variance ellipses > > ####################################################################### > > library(netresponse) Loading required package: Rgraphviz Loading required package: graph Loading required package: BiocGenerics Loading required package: parallel Attaching package: 'BiocGenerics' The following objects are masked from 'package:parallel': clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from 'package:stats': IQR, mad, sd, var, xtabs The following objects are masked from 'package:base': Filter, Find, Map, Position, Reduce, anyDuplicated, append, as.data.frame, cbind, colMeans, colSums, colnames, do.call, duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Loading required package: grid Loading required package: minet Loading required package: mclust Package 'mclust' version 5.4 Type 'citation("mclust")' for citing this R package in publications. Loading required package: reshape2 netresponse (C) 2008-2016 Leo Lahti et al. https://github.com/antagomir/netresponse > #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R") > #source("˜/Rpackages/netresponse/netresponse/R/internals.R") > #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R") > #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so") > > > ######### Generate DATA ############################################# > > res <- generate.toydata() > D <- res$data > component.means <- res$means > component.sds <- res$sds > sample2comp <- res$sample2comp > > ###################################################################### > > # Fit nonparametric Gaussian mixture model > out <- vdp.mixt(D) > # out <- vdp.mixt(D, c.max = 3) # try with limited number of components -> OK > > ############################################################ > > # Compare input data and results > > ord.out <- order(out$posterior$centroids[,1]) > ord.in <- order(component.means[,1]) > > means.out <- out$posterior$centroids[ord.out,] > means.in <- component.means[ord.in,] > > # Cluster stds and variances > sds.out <- out$posterior$sds[ord.out,] > sds.in <- component.sds[ord.in,] > vars.out <- sds.out^2 > vars.in <- sds.in^2 > > # Check correspondence between input and output > if (length(means.in) == length(means.out)) { + cm <- cor(as.vector(means.in), as.vector(means.out)) + csd <- cor(as.vector(sds.in), as.vector(sds.out)) + } > > # Plot results (assuming 2D) > > ran <- range(c(as.vector(means.in - 2*vars.in), + as.vector(means.in + 2*vars.in), + as.vector(means.out + 2*vars.out), + as.vector(means.out - 2*vars.out))) > > plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) > for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") } > for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") } > > > > proc.time() user system elapsed 2.65 0.12 2.76 |
netresponse.Rcheck/examples_i386/netresponse-Ex.timings
|
netresponse.Rcheck/examples_x64/netresponse-Ex.timings
|