INNER CODE UNIT · Ruby

circle_in

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

        circle_in = Numo::DFloat[1 - Numo::NMath.cos(linsp_in), 1 - Numo::NMath.sin(linsp_in) - 0.5].transpose
        x = Numo::DFloat.vstack([circle_out, 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 Gaussian blobs.
      #
      # @param n_samples [Integer] The total number of samples.
      # @param n_features [Integer] The number of features.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…