def test_estimate_is_near_truth(self, nTrial=2):
    vopt = HBO.beta2v(self.truebeta)
    objfunc = lambda v: HBO.objectiveFunc(v, self.alpha, self.gamma, self.G, self.sumLogPi)
    success = 0
    print vopt, '*optimal*'

    for trial in range(nTrial):
      initV = np.random.rand(self.K)
      v = HBO.estimate_v(self.gamma, self.alpha, self.G, self.K, self.sumLogPi, initV )
      if np.all( np.abs(vopt - v) < .01 ):
        success += 1
      elif objfunc(v) < objfunc(vopt):
        success += 1
      else:
        print v
    print "%d/%d suceeded." % (success, nTrial)
    assert success == nTrial
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/tests/allocmodel/admix/TestHDPBetaOptimizer.py/TestHBOK2.test_estimate_is_near_truth/swapped operands of `-`