INNER CODE UNIT · Ruby
x
yoshoku/rumale · rumale-core/lib/rumale/dataset.rb:77
x = Numo::DFloat.vstack([circle_out, factor * circle_in])
y = Numo::Int32.hstack([Numo::Int32.zeros(n_samples_out), Numo::Int32.ones(n_samples_in)])
# shuffle data indices.
if shuffle
rand_ids = Array(0...n_samples).shuffle(random: rng.dup)
x = x[rand_ids, true].dup
y = y[rand_ids].dup
end
# add gaussian noise.
x += ::Rumale::Utils.rand_normal(x.shape, rng.dup, 0.0, noise) unless noise.nil?
[x, y]
end
# Generate a two-dimensional data set consisting of two half circles shifted.
#
# @param n_samples [Integer] The number of samples.
# @param shuffle [Boolean] The flag indicating whether to shuffle the dataset
# @param noise [Float] The standard deviaion of gaussian noise added to the data.