INNER CODE UNIT · Ruby

x

yoshoku/rumale · rumale-core/lib/rumale/dataset.rb:158

        x = ::Rumale::Utils.rand_normal([sz_cluster[0], n_features], rng, 0.0, cluster_std) + centers[0, true]
        y = Numo::Int32.zeros(sz_cluster[0])
        (1...n_centers).each do |n|
          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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…