-1

I have a dataset with 400K observations and 250 features. I would like to perform the stratified sampling.

I referred many links, but they are all after 1 or two variables examples including Target.

Can anybody please help me how should be performing stratified sampling using R / Python.

thanks in Adavance !

1
  • stratified on what? one one variable? is it the y? is it numerical or categorical? Commented Jun 13, 2018 at 7:29

1 Answer 1

0

If you first group your data.frame, you can sample each group using dplyr's sample_n()

library(dplyr)
sample.df <- df %>% group_by( ID ) %>% sample_n( 10 )
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.