Question

Get random features from a dataset

  • 7 September 2021
  • 4 replies
  • 58 views

Badge +10

hello there w want to extract some features from the dataset randomly

ex:

we have 300 features coming in we want to get only 160 from them randomly

we trayed to use the sample, but it did work since its working base on the N rate

Any suggestion

Thanks

 


4 replies

Userlevel 1
Badge +21

You can change the sampling type to the first N features, set N to 160 and select Yes for Randomize sampling. Note that this will select 160 features out of the 300 at random but they will be in the original order.

 

If you want a random order, you can use a random number generator, sort by the random number then use the sampler to get the first 160

Badge +10

Thanks

Great

Badge +10

is there a way we could assign the sampling value to an attribute value , its taking only parameter , since this value will depend on count of the coming features

Thanks

Userlevel 1
Badge +21

is there a way we could assign the sampling value to an attribute value , its taking only parameter , since this value will depend on count of the coming features

Thanks

I don't think it's possible in the sampler. An alternative would be after sorting to use a counter, followed by a tester and only pass features where count < sample size

Reply