evelinag / clusternomics Goto Github PK
View Code? Open in Web Editor NEWIntegrative clustering for heterogeneous biomedical datasets.
License: Other
Integrative clustering for heterogeneous biomedical datasets.
License: Other
Hi,
the vignette has a use of the numberOfClusters function that does not seem to work. The code below is the setup as used in the vignette; I'll use a separate chunk to highlight issue.
library(clusternomics)
library(ggplot2)
library(dplyr)
set.seed(1)
# Number of elements in each cluster, follows the table given above
groupCounts <- c(50, 10, 40, 60)
# Centers of clusters
means <- c(-10.5,1.5)
# Helper function to generate test data
testData <- generateTestData_2D(groupCounts, means)
datasets <- testData$data
# Setup of the algorithm
dataDistributions <- 'diagNormal'
# Pre-specify number of clusters
clusterCounts <- list(global=10, context=c(3,3))
# Set number of iterations
# The following is ONLY FOR SIMULATION PURPOSES
# Use larger number of iterations for real-life data
maxIter <- 300
burnin <- 200
lag <- 2 # Thinning of samples
# Run context-dependent clustering
results <- contextCluster(datasets, clusterCounts,
maxIter = maxIter, burnin = burnin, lag = lag,
dataDistributions = 'diagNormal',
verbose = F)
# Extract resulting cluster assignments
samples <- results$samples
# Extract global cluster assignments for each MCMC sample
clusters <- lapply(1:length(samples), function(i) samples[[i]]$Global)
This is how the numberOfClusters function is used:
cc <- numberOfClusters(clusters)
However, this creates an error as numberOfClusters refers to nrow(clusters); I think something like the following might be closer? I'm not sure though as there are some issues I'm finding in recreating the code from the vignette with this.
cc <- lapply(1:length(clusters), function(i) unique(clusters[[i]]) %>% length)
Possibly the issue is that clusters is a list of vectors rather than a data.frame? Or that I've done something mad. The last shouldn't be entirely discounted.
First of all thanks for releasing the package.
I am trying to use it with 3 (or 4) context datasets and it fails with an error:
"
Number of datasets is different from number of contexts.
"
I traced it to line 84 in clusternomics.R where the length of the list is checked with number of datasets, but the length of the $context should be checked instead.
I tried to fix that and install from source and it seems to work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.