lib/rumale/kernel_machine/kernel_svc.rb in rumale-0.19.2 vs lib/rumale/kernel_machine/kernel_svc.rb in rumale-0.19.3
- old
+ new
@@ -170,10 +170,10 @@
weight_vec = Numo::DFloat.zeros(n_training_samples)
sub_rng = @rng.dup
# Start optimization.
@params[:max_iter].times do |t|
# random sampling
- rand_ids = [*0...n_training_samples].shuffle(random: sub_rng) if rand_ids.empty?
+ rand_ids = Array(0...n_training_samples).shuffle(random: sub_rng) if rand_ids.empty?
target_id = rand_ids.shift
# update the weight vector
func = (weight_vec * bin_y).dot(x[target_id, true].transpose).to_f
func *= bin_y[target_id] / (@params[:reg_param] * (t + 1))
weight_vec[target_id] += 1.0 if func < 1.0