Questions tagged [subsampling]
116 questions
68
votes
14 answers
Scikit-learn balanced subsampling
I'm trying to create N balanced random subsamples of my large unbalanced dataset. Is there a way to do this simply with scikit-learn / pandas or do I have to implement it myself? Any pointers to code that does this?
These subsamples should be random…

mikkom
- 3,521
- 5
- 25
- 39
16
votes
3 answers
Subsample pandas dataframe
I have a DataFrame loaded from a .tsv file. I wanted to generate some exploratory plots. The problem is that the data set is large (~1 million rows), so there are too many points on the plot to see a trend. Plus, it is taking a while to plot.
I…

Nishant
- 54,584
- 13
- 112
- 127
11
votes
3 answers
Subsampling/averaging over a numpy array
I have a numpy array with floats.
What I would like to have (if it is not already existing) is a function that gives me a new array of the average of every x points in the given array, like sub sampling (and opposite of interpolation(?)).
E.g.…

Michel Keijzers
- 15,025
- 28
- 93
- 119
7
votes
3 answers
How to subsample a 2D polygon?
I have polygons that define the contour of counties in the UK. These shapes are very detailed (10k to 20k points each), thus rendering the related computations (is point X in polygon P?) quite computationaly expensive.
Thus, I would like to…

Wookai
- 20,883
- 16
- 73
- 86
6
votes
4 answers
How can SciKit-Learn Random Forest sub sample size may be equal to original training data size?
In the documentation of SciKit-Learn Random Forest classifier , it is stated that
The sub-sample size is always the same as the original input sample size but the samples are drawn with replacement if bootstrap=True (default).
What I dont…

TAK
- 61
- 1
- 3
6
votes
2 answers
How to compress YUYV raw data to JPEG using libjpeg?
I'm looking for an example of how to save a YUYV format frame to a JPEG file using the libjpeg library.

vdm
- 185
- 1
- 4
- 16
5
votes
4 answers
R (and dplyr?) - Sampling from a dataframe by group, up to a maximum sample size of n
I have a dataframe which contains multiple samples (1-n) per group. I would like to sample this dataset, without replacement, so that I have a maximum of 5 samples per group (1-5).
This problem has previously been described and answered here. In…

Aaarrrgh's My Game
- 111
- 1
- 6
5
votes
1 answer
Box filter size in relation to Gaussian filter sigma
In order to evaluate the performance impact (both computational and quality-wise) of using a box filter / mean filter vs using a gaussian filter, I an wondering if there is a proper relationship between the size of the box filter and the sigma of a…

Jack White
- 409
- 4
- 11
5
votes
1 answer
Subsampling scale image view - make pin markers clickable on Imageview
I'm using Dave Morrissey's Subsampling Scale Image View. I modified the Pinview example (as shown here:…

venkatesh shanmuganathan
- 196
- 1
- 3
- 13
5
votes
0 answers
Difference between subsampling and downscaling (image)?
I know that there are many ways to upscale (interpolate) an image using bilinear, bicubic,... Somehow, these same algorithms can also be used to downscale an image. But when it comes to subsampling, I've come across only two methods: Gaussian-blur…

Myath
- 553
- 1
- 6
- 23
4
votes
1 answer
Sample to Create Uniform Distribution from Non-Uniform Data
Given a dataset with a non-uniform distribution (highly peaked) I want to resample to create a new dataset with an approximately uniform distribution. My approach:
Divide the data into bins.
Target bin level = Smallest number of samples per bin,…

Ron Cohen
- 2,815
- 5
- 30
- 45
4
votes
1 answer
Importing and extracting a random sample from a large .CSV in R
I'm doing some analysis in R where I need to work with some large datasets (10-20GB, stored in .csv, and using the read.csv function).
As I will also need to merge and transform the large .csv files with other data frames, I don't have the computing…

RMAkh
- 123
- 1
- 10
4
votes
1 answer
Disable Java ImageIO Chroma Subsampling
I'm attempting to save a BufferedImage as JPEG using ImageIO. But even when saving using 100 quality, I am suffering quality loss due to Chroma SubSampling.
I have successfully fixed this issue by reverting to the older JAI libraries and explicitly…

ejthurgo
- 53
- 1
- 6
3
votes
1 answer
In Matlab, how can I use chroma subsampling to downscale a 4:4:4 image to 4:1:1 when the image is in YCbCr?
Following this exact question
In Matlab, how can I use chroma subsampling to downscale a 4:4:4 image to 4:2:0 when the image is in YCbCr?
where he is performing chroma downscaling from 4:4:4 to 4:2:0, I wanna dowscale from 4:4:4 to 4:1:1. Im not…

Sanam
- 243
- 5
- 15
3
votes
3 answers
YUV420 to RGB conversion
I converted an RGB matrix to YUV matrix using this formula:
Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16
Cr = V = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128
Cb = U = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128
I then did a 4:2:0…

doc
- 71
- 1
- 3
- 7