Dear all,
I am working about the bayesian non-negative matrix factorization. I
found a paper about this:
http://mlg.eng.cam.ac.uk/pub/pdf/SchWinHan09.pdf
I would like to do the same in WinBUGS. When I run my model, I can
only do 100 model update. With more update, the model don't run. Any
idea?
This my code:
#Bayesian non negative matrix factor;
model{
for (i in 1:N_mutational){
for (j in 1:N_obs){
W[i,j]~dnorm(X[i,j],tau)
X[i,j]<-A[i,1]*B[1,j]+A[i,2]*B[2,j]
}
for (z in 1:2){
A[i,z] ~ dexp(alpha[i,z])
alpha[i,z] ~ dnorm(0,0.0001)
}
}
for (z in 1:2){
for (j in 1:N_obs){
B[z,j] ~ dexp(beta[z,j])
beta[z,j] ~ dnorm(0,0.0001)
}
}
tau ~ dgamma(0.0001,0.0001)
sigma <- 1 / sqrt(tau)
}
Initial data:
list(A = structure(.Data = c(0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001,
0.000001,
0.000001, 0.000001, 0.000001, 0.000001, 0.000001, 0.000001), .Dim = c(96, 2)),
B = structure(.Data = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1), .Dim = c(2, 10)),
alpha = structure(.Data = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim =
c(96, 2)), beta = structure(.Data = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(2, 10)), tau=1
)
load data:
list( N_mutational=96, N_obs=10, W = structure(
.Data = c(28, 14, 49, 21, 6, 24, 6, 4, 40, 31, 11, 22, 21, 45, 8, 9,
14, 5, 15, 20,
14, 24, 44, 8, 14, 7, 31, 10, 9, 23, 1, 6, 37, 9,
14, 27, 15, 15, 8, 7, 12, 8, 11, 17, 11, 15, 18,
9, 18, 5, 26, 14, 9, 22, 7, 2, 30, 13, 11, 31, 1,
22, 3, 6, 7, 1, 10, 16, 3, 9, 25, 8, 22, 33, 51,
16, 11, 38, 5, 2, 23, 23, 44, 41, 18, 26, 16, 11,
18, 9, 7, 11, 6, 25, 25, 23, 146, 18, 38, 13, 8,
17, 0, 0, 42, 11, 13, 25, 24, 41, 14, 12, 20, 17,
7, 34, 4, 13, 36, 11, 14, 7, 31, 4, 8, 31, 2, 4,
31, 8, 13, 34, 10, 13, 5, 8, 18, 5, 8, 13, 9, 8,
18, 18, 32, 3, 29, 16, 9, 27, 3, 2, 38, 7, 8, 16,
1, 27, 9, 9, 10, 5, 9, 12, 33, 3, 21, 13, 36, 23,
52, 19, 14, 29, 1, 3, 19, 24, 39, 41, 11, 23, 20,
12, 22, 16, 5, 17, 6, 12, 24, 27, 41, 19, 72, 25,
9, 27, 9, 4, 77, 23, 19, 54, 24, 80, 19, 14, 24,
8, 9, 40, 11, 24, 57, 15, 24, 16, 36, 18, 8, 35,
2, 4, 50, 25, 16, 43, 19, 32, 5, 14, 22, 10, 22,
30, 9, 8, 36, 12, 19, 7, 28, 14, 9, 35, 9, 3, 52,
10, 16, 41, 4, 33, 5, 10, 15, 5, 5, 26, 13, 10,
24, 12, 22, 21, 43, 23, 12, 35, 2, 7, 41, 29, 26,
59, 14, 28, 15, 12, 29, 8, 7, 18, 12, 27, 32, 36,
74, 43, 98, 26, 16, 38, 7, 3, 34, 23, 29, 55, 46,
130, 29, 21, 29, 6, 25, 50, 14, 35, 64, 25, 25, 9,
43, 20, 10, 47, 3, 4, 35, 15, 20, 80, 8, 31, 12,
16, 56, 10, 17, 30, 13, 13, 82, 26, 25, 13, 42, 16,
13, 29, 2, 20, 46, 19, 10, 33, 11, 46, 20, 12, 31,
13, 28, 29, 66, 14, 44, 27, 29, 28, 45, 18, 23, 76,
2, 10, 29, 41, 62, 149, 33, 40, 19, 11, 84, 15, 10,
22, 15, 47, 123, 60, 392, 37, 103, 18, 9, 21, 3,
4, 38, 22, 27, 40, 53, 110, 23, 21, 52, 10, 17, 51,
8, 24, 50, 28, 66, 16, 35, 8, 13, 22, 3, 3, 27,
8, 17, 47, 7, 25, 3, 5, 63, 10, 20, 21, 10, 12,
41, 19, 68, 10, 34, 8, 10, 20, 3, 16, 20, 14, 14,
30, 10, 29, 141, 5, 20, 35, 20, 27, 253, 6, 23, 94,
118, 24, 46, 26, 14, 40, 4, 7, 26, 29, 38, 140, 21,
25, 22, 10, 82, 20, 9, 16, 16, 28, 96, 49, 117, 82,
159, 60, 54, 85, 17, 22, 161, 55, 51, 139, 53, 245,
37, 59, 120, 22, 37, 115, 34, 84, 138, 54, 55, 18,
125, 67, 18, 108, 26, 6, 149, 60, 25, 121, 59, 157,
14, 66, 115, 21, 62, 94, 24, 47, 134, 33, 49, 41,
97, 22, 29, 85, 17, 17, 189, 29, 35, 89, 19, 127,
32, 21, 105, 29, 31, 89, 51, 33, 107, 26, 49, 40,
126, 43, 45, 76, 20, 9, 102, 64, 111, 173, 64, 110,
48, 35, 123, 45, 47, 65, 50, 41, 123, 115, 129, 93,
208, 63, 46, 94, 27, 31, 345, 44, 67, 185, 54, 465,
64, 48, 219, 36, 45, 163, 65, 174, 205, 46, 73, 24,
135, 74, 11, 95, 30, 9, 164, 84, 30, 160, 82, 289,
15, 49, 219, 5, 53, 89, 19, 50, 223, 19, 45, 58,
114, 44, 44, 82, 8, 23, 200, 41, 53, 139, 23, 289,
67, 22, 128, 56, 37, 70, 58, 40, 175, 62, 70, 56,
125, 39, 60, 81, 19, 17, 121, 62, 134, 230, 64, 170,
60, 37, 196, 100, 47, 72, 87, 42, 201, 164, 462, 424,
804, 172, 384, 465, 98, 179, 1031, 228, 410, 803, 274,
1911, 263, 227, 880, 294, 195, 548, 418, 616, 1498,
314, 400, 54, 630, 379, 54, 547, 191, 16, 818, 337,
61, 559, 466, 2770, 43, 285, 1781, 63, 463, 430, 63,
232, 1390, 68, 171, 420, 612, 88, 367, 272, 93, 139,
731, 140, 251, 594, 108, 1637, 418, 77, 1206, 322,
241, 390, 410, 193, 1516, 292, 266, 232, 582, 205,
341, 327, 63, 181, 521, 147, 387, 885, 268, 982, 200,
156, 1773, 562, 367, 434, 588, 145, 779, 444, 4336,
3806, 6932, 1286, 3136, 4610, 957, 1582, 8451, 2084,
3179, 8158, 2207, 16628, 2611, 1843, 8272, 2615, 2074,
4750, 3363, 3883, 12426, 2742, 3356, 439, 4922, 3215,
354, 5144, 1723, 192, 7602, 2843, 420, 5123, 4612, 20577,
311, 2603, 12876, 473, 3723, 3365, 403, 2150, 12036,
545, 1298, 3080, 5090, 592, 3153, 2804, 1038, 1272,
7001, 1091, 2020, 5452, 968, 12595, 3162, 841, 11410,
2974, 2580, 3970, 2884, 1864, 12798, 2548, 2113, 2043,
5125, 1418, 2720, 2965, 614, 1631, 5221, 1121, 3527,
8889, 2033, 9284, 1879, 1206, 13460, 4590, 3396, 3370,
4403, 1141, 7657, 4042, 7196, 6062, 10773, 1823, 5361,
7906, 1858, 3848, 14718, 3812, 5332, 14936, 4100, 28429,
4247, 2645, 14910, 4539, 3512, 3278, 6381, 5501, 20327,
4849, 5347, 259, 9304, 4916, 281, 9448, 3457, 201, 14533,
4512, 344, 7786, 5659, 35280, 226, 4356, 24557, 421,
6526, 2424, 313, 3858, 23217, 477, 1994, 5280, 9414,
853, 5783, 4728, 2407, 2627, 13713, 1785, 3385, 8332,
1710, 18944, 5222, 1393, 22003, 5648, 4664, 2981, 5165,
3305, 23753, 4389, 3467, 3301, 8962, 2351, 4023, 4923,
1231, 3281, 9747, 1661, 5585, 14737, 3308, 15556, 3142,
2210, 24181, 7158, 5863, 2178, 7836, 1722, 13029, 6140),
.Dim = c(96, 10)
)
)
And, this is my pipeline in OpenBUGS:
# Check model syntax
modelCheck('modeloNMF.txt')
# Load data
modelData('loaddata.txt')
# Compile with one chain
modelCompile(1)
# Load inital values for first chain
modelInits('initialdata.txt',1)
modelGenInits()
# Start with 13000 update burn-in
modelUpdate(13000)
# Set nodes of interest
samplesSet('alpha[,]')
samplesSet('A[,]')
samplesSet('B[,]')
samplesSet('beta[,]')
samplesSet('tau')
samplesSet('sigma')
# Follow by a further 7,000 updates
modelUpdate(7000)
# Look at sample statistics
samplesStats('*')
samplesCoda('*',supervalor_)
Thanks for all,
----------------------------------------------------------------------------------------------
Este mensaje fue enviado desde Webmail Red de Investigacion del
Hospital 12 de Octubre (Madrid)
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|