def fitModel(Y, K, singleSigma = False):
	N, D = Y.shape
	if D > 2000:
		print 'Warning: this dataset has a large number of genes. If ZIFA takes too long to run, try using block_ZIFA.py instead'
	testInputData(Y)
	print 'Running zero-inflated factor analysis with N = %i, D = %i, K = %i' % (N, D, K)
	#initialize the parameters
	np.random.seed(23)
	A, mus, sigmas, decay_coef = initializeParams(Y, K, singleSigma = singleSigma)
	checkNoNans([A, mus, sigmas, decay_coef])
	max_iter = 100
	param_change_thresh = 1e-2
	n_iter = 0
	while n_iter < max_iter:
		EZ, EZZT, EX, EXZ, EX2 = Estep(Y, A, mus, sigmas, decay_coef)
		new_A, new_mus, new_sigmas, new_decay_coef = Mstep(Y, EZ, EZZT, EX, EXZ, EX2, A, mus, sigmas, decay_coef, singleSigma = singleSigma)
		checkNoNans([EZ, EZZT, EX, EXZ, EX2, new_A, new_mus, new_sigmas, new_decay_coef])
		paramsNotChanging = True
		max_param_change = 0
		for new, old in [[new_A, A], [new_mus, mus], [new_sigmas, sigmas], [new_decay_coef, decay_coef]]:
			rel_param_change = np.mean(np.abs(new - old)) / np.mean(np.abs(new))
			if rel_param_change > max_param_change:
				max_param_change = rel_param_change
			if rel_param_change > param_change_thresh:
				paramsNotChanging = False
				break
		A = new_A
		mus = new_mus
		sigmas = new_sigmas
		decay_coef = new_decay_coef
		if paramsNotChanging:
			print 'Param change below threshold %2.3e after %i iterations' % (param_change_thresh, n_iter)
			break
		if n_iter >= max_iter:
			print 'Maximum number of iterations reached; terminating loop'
		n_iter += 1	
	EZ, EZZT, EX, EXZ, EX2 = Estep(Y, A, mus, sigmas, decay_coef)
	params = {'A':A, 'mus':mus, 'sigmas':sigmas, 'decay_coef':decay_coef}
	return EZ, params
Get all the trophies for a given review request.
dataset/ETHPy150Open epierson9/ZIFA/ZIFA/ZIFA.py/fitModel--crossover with--dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/accounts/managers.py/TrophyManager.get_trophies