【发布时间】:2016-11-17 12:07:00
【问题描述】:
minΣ(||xi-Xci||^2+ λ||ci||),
s.t cii = 0,
其中X是d * n形状的矩阵,C是n * n形状的矩阵,xi和ci分别表示X和C的列。
X 在这里是已知的,我们想根据 X 找到 C。
【问题讨论】:
标签: machine-learning tensorflow theano deep-learning convex-optimization
minΣ(||xi-Xci||^2+ λ||ci||),
s.t cii = 0,
其中X是d * n形状的矩阵,C是n * n形状的矩阵,xi和ci分别表示X和C的列。
X 在这里是已知的,我们想根据 X 找到 C。
【问题讨论】:
标签: machine-learning tensorflow theano deep-learning convex-optimization
通常会有这样的损失,您需要对其进行矢量化,而不是使用列:
loss = X - tf.matmul(X, C)
loss = tf.reduce_sum(tf.square(loss))
reg_loss = tf.reduce_sum(tf.square(C), 0) # L2 loss for each column
reg_loss = tf.reduce_sum(tf.sqrt(reg_loss))
total_loss = loss + lambd * reg_loss
要在 C 的对角线上实现零约束,最好的方法是用另一个常数 lambd2 将其添加到损失中:
reg_loss2 = tf.trace(tf.square(C))
total_loss = total_loss + lambd2 * reg_loss2
【讨论】: