#NEWLINE# def pca_model( M , N , D ) : #NEWLINE# #INDENT# alpha = nodes . Gamma ( 0.01 , 0.01 , plates = ( D , ) , name = 'alpha' ) #NEWLINE# W = nodes . Gaussian ( np . zeros ( D ) , alpha . as_diagonal_wishart ( ) , name = 'W' , plates = ( M , 1 ) ) #NEWLINE# X = nodes . Gaussian ( np . zeros ( D ) , np . identity ( D ) , name = 'X' , plates = ( 1 , N ) ) #NEWLINE# WX = nodes . Dot ( W , X , name = 'WX' ) #NEWLINE# tau = nodes . Gamma ( 0.01 , 0.01 , name = 'tau' , plates = ( ) ) #NEWLINE# Y = nodes . GaussianARD ( WX , tau , name = 'Y' , plates = ( M , N ) ) #NEWLINE# return ( Y , WX , W , X , tau , alpha )