我有一个模拟退火算法,并且我有一个函数
result = w1*x1 + w2*x2 + ... + wn*xn
当选择新的w值时,模拟退火的每个循环如何确保w的和总是等于1,并且没有单个w值小于0?
非常感谢各位!
发布于 2015-12-04 03:39:20
result = w1*x1 + w2*x2 + ... + wn*xn来执行result = np.dot(w, x)了。w上需要的条件似乎来自于:
non_negative_w = np.abs(w) sum_w = np.sum( non_negative_w ) normalized_non_negative_w =non_negative_w/ sum_whttps://stackoverflow.com/questions/34080486
复制相似问题