def projectL(self, L): if L.ndim == 3: pL = np.zeros(L.shape,"float") for i in range(L.shape[2]): pL[...,i] = utils.project_simplex(L[...,i], self.I0_sum[i]) return pL else: return utils.project_simplex(L, self.I0_sum)
def projectL(self, L): if L.ndim == 3: pL = np.zeros(L.shape, "float") for i in range(L.shape[2]): pL[..., i] = utils.project_simplex(L[..., i], self.I0_sum[i]) return pL else: return utils.project_simplex(L, self.I0_sum)
def projectP(self, P): #~ #~ pcut = P.max() * self.cutoff #~ if pcut <0 : #~ raise ValueError("P was all negative!") #~ P = P * (P > pcut) #~ P /= P.sum() #~ return P return utils.project_simplex(P)
def projectXP(self, X): return utils.project_simplex(X)