if __name__ == '__main__': np.random.seed(123) J = 3 N = int(1e5) K = 2 ncomps = 3 true_labels, data = generate_data(n=N, k=K, ncomps=ncomps) data = data - data.mean(0) data = data/data.std(0) # shuffle the data... ind = np.arange(N) np.random.shuffle(ind) all_data = data[ind].copy() data = [all_data[(N/J*i):(N/J*(i+1))].copy() for i in range(J)] mcmc = HDPNormalMixture( data, ncomp=10, parallel=False, verbose=0, gpu=True ) nburn = 20 niter = 2 iter_tracker = Callable(nburn, niter) mcmc.sample(niter=niter, nburn=nburn, tune_interval=100, callback=iter_tracker) print mcmc.mu[-1][-1]
J = 3 N = int(1e5) K = 2 ncomps = 3 true_labels, data = generate_data(n=N, k=K, ncomps=ncomps) data = data - data.mean(0) data = data / data.std(0) # shuffle the data... ind = np.arange(N) np.random.shuffle(ind) all_data = data[ind].copy() data = [all_data[(N / J * i):(N / J * (i + 1))].copy() for i in range(J)] mcmc = HDPNormalMixture(data, ncomp=10, parallel=False, verbose=0, gpu=True) nburn = 20 niter = 2 iter_tracker = Callable(nburn, niter) mcmc.sample(niter=niter, nburn=nburn, tune_interval=100, callback=iter_tracker) print mcmc.mu[-1][-1]
from test_help import * import numpy as np from hdp import HDPNormalMixture if __name__ == '__main__': np.random.seed(123) J = 3 N = int(1e5) K = 2 ncomps = 3 true_labels, data = generate_data(n=N, k=K, ncomps=ncomps) data = data - data.mean(0) data = data/data.std(0) # shuffle the data... ind = np.arange(N) np.random.shuffle(ind) all_data = data[ind].copy() data = [all_data[(N/J*i):(N/J*(i+1))].copy() for i in range(J)] mcmc = HDPNormalMixture( data, ncomp=10, parallel=False, verbose=1, gpu=True ) mcmc.sample(niter=2, nburn=8, tune_interval=100) print mcmc.mu[-1][-1]
#import gpustats as gs if __name__ == '__main__': J = 20 N = int(1e7) K = 2 ncomps = 3 true_labels, data = generate_data(n=N, k=K, ncomps=ncomps) data = data - data.mean(0) data = data/data.std(0) #shuffle the data ... ind = np.arange(N); np.random.shuffle(ind); all_data = data[ind].copy() data = [ all_data[(N/J*i):(N/J*(i+1))].copy() for i in range(J) ] #mcmc = HDPNormalMixture(data, ncomp=3, gpu=[0,1,2], parallel=True, verbose=100) mcmc = HDPNormalMixture(data, ncomp=100, parallel=True, verbose=1,gpu=[0,1,2,3,4]) mcmc.sample(2, nburn=1, tune_interval=50) #import pdb; pdb.set_trace() #imcmc = HDPNormalMixture(mcmc, verbose=100) #imcmc.sample(100, nburn=0, ident=True) #print imcmc.mu[-1] #print imcmc.weights[-1] #print imcmc.beta[-1]
import numpy as np from hdp import HDPNormalMixture if __name__ == '__main__': np.random.seed(123) J = 3 N = int(1e5) K = 2 ncomps = 3 true_labels, data = generate_data(n=N, k=K, ncomps=ncomps) data = data - data.mean(0) data = data / data.std(0) # shuffle the data... ind = np.arange(N) np.random.shuffle(ind) all_data = data[ind].copy() data = [all_data[(N / J * i):(N / J * (i + 1))].copy() for i in range(J)] mcmc = HDPNormalMixture(data, ncomp=10, parallel=False, verbose=1, gpu=True) mcmc.sample(niter=2, nburn=8, tune_interval=100) print mcmc.mu[-1][-1]