lib/svmkit/decomposition/nmf.rb in svmkit-0.6.0 vs lib/svmkit/decomposition/nmf.rb in svmkit-0.6.1
- old
+ new
@@ -119,14 +119,14 @@
# optimization.
@params[:max_iter].times do
# update
if update_comps
nume = coefficients.transpose.dot(x)
- deno = (coefficients.transpose.dot(coefficients)).dot(@components) + @params[:eps]
+ deno = coefficients.transpose.dot(coefficients).dot(@components) + @params[:eps]
@components *= (nume / deno)
end
nume = x.dot(@components.transpose)
- deno = (coefficients.dot(@components)).dot(@components.transpose) + @params[:eps]
+ deno = coefficients.dot(@components).dot(@components.transpose) + @params[:eps]
coefficients *= (nume / deno)
# normalize
norm = Numo::NMath.sqrt((@components**2).sum(1)) + @params[:eps]
@components /= norm.expand_dims(1) if update_comps
coefficients *= norm