Questions tagged [subsampling]

116 questions
3
votes
2 answers

How can I subsample an array according to its density? (Remove frequent values, keep rare ones)

I have this problem that I want to plot a data distribution where some values occur frequently while others are quite rare. The number of points in total is around 30.000. Rendering such a plot as png or (god forbid) pdf takes forever and the pdf is…
oarfish
  • 4,116
  • 4
  • 37
  • 66
3
votes
3 answers

R sample N rows of a dataframe as evenly as possible across M clusters (but randomly within)

I have a dataframe of the form shown below. The cases have been pre-clustered into subgroups of varying populations, including singletons. I am trying to write some code that will sample (without replacement) any specified number of rows from the…
ADV
  • 33
  • 5
3
votes
1 answer

How can I subsample a SpatialPointsDataFrame in R

I am working on running RandomForest. I've imported point data representing used and unused sites and created a raster stack from raster GIS layers. I've created a SpatialPointDataFrame with all of my used and unused points with their underlying…
user3088823
  • 81
  • 3
  • 5
2
votes
1 answer

R Obtain quantile and mean from a tailored subset in the dataset

I would like to obtain quantile in a tailored subset. For example in the following dataset: data = data.table(x=c(rep(1,9),rep(2,9)),y=c(rep(1:6,each=3)),z=1:18) For each row i, I want to know, in the rows with x=x[i] and y=
2
votes
2 answers

variable length df subsampling function r

I need to write a function involving subsetting a df by a variable n bins. Like, if n is 2, then subsample the df some number of times in two bins (from the first half, then from the second half). If n is 3, subsample in 3 bins (first 1/3, second…
Jake L
  • 987
  • 9
  • 21
2
votes
1 answer

Word2Vec Subsampling -- Implementation

I am implementing the Skipgram model, both in Pytorch and Tensorflow2. I am having doubts about the implementation of subsampling of frequent words. Verbatim from the paper, the probability of subsampling word wi is computed as where t is a custom…
Pietro
  • 415
  • 6
  • 16
2
votes
2 answers

Subsampling videos to save every Nth frame

I have thousands of 30sec/20fps/.avi videos (so 600 frames total per video). I need to automate subsampling these videos in order to save every 100th frame (every 5 seconds). Any picture format is fine. Is there an easy way to do this in either…
Austin
  • 6,921
  • 12
  • 73
  • 138
2
votes
2 answers

Randomly sample per group, make a new dataframe, repeat until all entities within a group are sampled

I want to take one random Site for every Region, create a new data frame, and repeat these processes until all Site are sampled. So, each data frame will NOT contain the same Site from the same Region. A few Regions in my real data frame have more…
Zuozuomu
2
votes
1 answer

Keras Convolution3D subsample error

I was trying to build a 3D convolutional layer using keras. It works fine, but when I added a subsample parameter it crashed. The code: l_1 = Convolution3D(2, 10,10,10, border_mode='same', name = 'l_1', activation='relu', subsample…
2
votes
1 answer

random subsampling of the majority class

I have an unbalanced data and I want to perform a random subsampling on the majority class where each subsample will be the same size as the minority class ... I think this is already implemented on Weka and Matlab, is there an equivalent to this on…
Ophilia
  • 717
  • 1
  • 10
  • 25
2
votes
2 answers

Android ViewPager using SubsamplingScaleImageView results in blank screen for sometime when sliding images

I have made a ViewPager using davemorrissey's SubsamplingScaleImageView When sliding the ViewPager, the next slide appears to be blank for some seconds before the image loads. Has anyone faced same type of issue ? Any pointers for possible fixes…
Gissipi_453
  • 1,250
  • 1
  • 25
  • 61
2
votes
1 answer

Interpreting JPEG Chroma Subsampling read from file

I am trying to find out of which MCU (8x8, 16x8 and 16x16) a pictures is made of. To do this I parse the Start of Frame (SOFn) Marker where the chroma subsampling factors are stored. I have found the following content: Number of Img components =…
ap0
  • 1,083
  • 1
  • 12
  • 37
2
votes
1 answer

Downsampling dataset

I have a dataset, which is a large character vector (1,024,459 elements), consisting of gene IDs. It looks like: > length(allres) [1] 1024459 >allres[1:10] [1] "1" "1" "1" "1" "1" "1" "1" "10" "10" "100" where each gene ID is…
Forest
  • 721
  • 1
  • 8
  • 14
2
votes
1 answer

Pandas subsampling

I have some event data that is measured in time, so the data format looks like Time(s) Pressure Humidity 0 10 5 0 9.9 5.1 0 10.1 5 1 10 4.9 2 …
ganesh reddy
  • 1,842
  • 7
  • 23
  • 38
2
votes
1 answer

Slicing a sparse scipy matrix to subsample for every 10th row and column

I am trying to subsample a scipy sparse matrix as a numpy matrix like this to get every 10th row and every 10th column: connections = sparse.csr_matrix((data,(node1_index,node2_index)), …
user2855672
  • 193
  • 1
  • 1
  • 5