lib/rumale/decomposition/nmf.rb in rumale-0.20.0 vs lib/rumale/decomposition/nmf.rb in rumale-0.20.1
- old
+ new
@@ -75,11 +75,11 @@
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The data to be transformed with the learned model.
# @return [Numo::DFloat] (shape: [n_samples, n_components]) The transformed data.
def transform(x)
x = check_convert_sample_array(x)
- partial_fit(x, false)
+ partial_fit(x, update_comps: false)
end
# Inverse transform the given transformed data with the learned model.
#
# @param z [Numo::DFloat] (shape: [n_samples, n_components]) The data to be restored into original space with the learned model.
@@ -89,10 +89,10 @@
z.dot(@components)
end
private
- def partial_fit(x, update_comps = true)
+ def partial_fit(x, update_comps: true)
# initialize some variables.
n_samples, n_features = x.shape
scale = Math.sqrt(x.mean / @params[:n_components])
sub_rng = @rng.dup
@components = Rumale::Utils.rand_uniform([@params[:n_components], n_features], sub_rng) * scale if update_comps