Question: BHC breaks on simple dataset
0
4.3 years ago by
b.curran0
New Zealand
b.curran0 wrote:

So, I've had the BHC package working for a time course experiment before. I'm trying to use the multinomial option instead of the timecourse one and it's breaking, spectacularly. The basic use case in the documentation works, but is very easy to break.

I started off with matrix of data, 47 rows, 10 columns, which upon running, immediately crashed R.

counts = read.table( datafile,sep=",", header=TRUE,row.names=1 , stringsAsFactors = FALSE )
itemLabels <- rownames(counts)
counts<-as.matrix(counts)
counts<-log(counts+1)
hc1 <- bhc(counts, itemLabels, dataType="multinomial",verbose=TRUE)

So I retreated to the sample code, replacing the first line of the sample matrix with the first line of my data. Again it crashed.

So I started incrementing the first element of the sample matrix by 1. When I get to 4, I get the following:

data         <- matrix(0,15,10)
itemLabels   <- vector("character",15)
data[1:5,]   <- 1 ; itemLabels[1:5]   <- "a"
data[6:10,]  <- 2 ; itemLabels[6:10]  <- "b"
data[11:15,] <- 3 ; itemLabels[11:15] <- "c"
data[1,1]<-5
hc1 <- bhc(data, itemLabels, verbose=TRUE)
plot(hc1, axes=FALSE)

[1] Running Bayesian Hierarchical Clustering....
[1] "DataType: multinomial"
[1] Optimising global hyperparameter...
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
Error! Input value outside range 0 0 4
[1]   0.7642338 -93.6824384
Error! Input value outside range 0 0 4
[1]    1.236254 -105.083198
Error! Input value outside range 0 0 4
[1]   0.4309005 -83.3977250
Error! Input value outside range 0 0 4
[1]   0.4309005 -83.3977250
Error! Input value outside range 0 0 4
[1]   0.4309005 -83.3977250
[1] Hyperparameter: 0.430900452187475
[1] Lower bound on overall LogEvidence: -8.3398e+01
[1] *******************

If you increase the first element up to 10, it crashes R, with a whole bunch of "Error! Input value outside range" errors.

It's happening on multiple machines, so I'm guessing it's not mine.

I've also reinstalled BHC just to make sure and still get the same thing.

Thoughts?

Cheers

Ben.

bhc • 741 views
modified 4.2 years ago by Rich Savage60 • written 4.3 years ago by b.curran0

I have the same problem. Do you solve it?

Thanks.

Christian.

Answer: BHC breaks on simple dataset
0
4.2 years ago by
Rich Savage60
University of Warwick, UK
Rich Savage60 wrote:

Hi folks,

I believe problem you are seeing is because the toy data you're inputting has 4 unique values {1,2,3,5}, but isn't using {1,2,3,4}.  I'm afraid that for N classes in the multinomial version of BHC, you need to use the numerical values 1:N

I'm not sure when the next update to BHC will happen, but we'll try and address this and make it a bit more robust.

Best regards,

Rich