INNER CODE UNIT · Ruby
c
yoshoku/rumale · rumale-core/lib/rumale/dataset.rb:161
c = ::Rumale::Utils.rand_normal([sz_cluster[n], n_features], rng, 0.0, cluster_std) + centers[n, true]
x = Numo::DFloat.vstack([x, c])
y = y.concatenate(Numo::Int32.zeros(sz_cluster[n]) + n)
end
# shuffle data.
if shuffle
rand_ids = Array(0...n_samples).shuffle(random: rng.dup)
x = x[rand_ids, true].dup
y = y[rand_ids].dup
end
[x, y]
end
private
def parse_libsvm_line(line, zero_based)
label = parse_label(line.shift)
adj_idx = zero_based == false ? 1 : 0