def _generateModel2(numCategories, alpha=0.25):
 initProb = (numpy.ones(numCategories) / numCategories)
 def generatePeakedProbabilities(lastIdx, numCategories=numCategories, alpha=alpha):
  probs = numpy.random.dirichlet(alpha=([alpha] * numCategories))
  probs[lastIdx] = 0.0
  probs /= probs.sum()
  return probs
 firstOrder = dict()
 for catIdx in range(numCategories):
  key = str([catIdx])
  probs = generatePeakedProbabilities(catIdx)
  firstOrder[key] = probs
 secondOrder = dict()
 for firstIdx in range(numCategories):
  for secondIdx in range(numCategories):
   key = str([firstIdx, secondIdx])
   probs = generatePeakedProbabilities(secondIdx)
   secondOrder[key] = probs
 return (initProb, firstOrder, secondOrder, None)

def _generateModel2 ( numCategories , alpha = 0.25 ) : initProb = ( numpy . ones ( numCategories ) / numCategories ) def generatePeakedProbabilities ( lastIdx , numCategories = numCategories , alpha = alpha ) : probs = numpy . random . dirichlet ( alpha = ( [ alpha ] * numCategories ) ) probs [ lastIdx ] = 0.0 probs /= probs . sum ( ) return probs firstOrder = dict ( ) for catIdx in range ( numCategories ) : key = str ( [ catIdx ] ) probs = generatePeakedProbabilities ( catIdx ) firstOrder [ key ] = probs secondOrder = dict ( ) for firstIdx in range ( numCategories ) : for secondIdx in range ( numCategories ) : key = str ( [ firstIdx , secondIdx ] ) probs = generatePeakedProbabilities ( secondIdx ) secondOrder [ key ] = probs return ( initProb , firstOrder , secondOrder , None )
generate the initial .