Questions tagged [downsampling]

231 questions
3
votes
4 answers

Subsampling an array of numbers

I have a series of 100 integer values which I need to reduce/subsample to 77 values for the purpose of fitting into a predefined space on screen. This gives a fraction of 77/100 values-per-pixel - not very neat. Assuming the 77 is fixed and cannot…
cdevelop
  • 43
  • 1
  • 5
3
votes
3 answers

How to resample / downsample an irregular timestamp list?

SImple question but I haven't been able to find a simple answer. I have a list of data which counts the time in seconds that events occur: [200.0 420.0 560.0 1100.0 1900.0 2700.0 3400.0 3900.0 4234.2 4800.0 etc..] I want to count how many events…
Harry Munro
  • 304
  • 2
  • 12
3
votes
1 answer

stratified sampling in pig?

Does anyone have an idea of how to make a stratified sampling in pig? (wikipedia) For the moment, I do something like : relation2 = SAMPLE relation1 0.05; but my dataset contains a label columns with a few occurrences, some of them are rare (0.5…
Scratch
  • 373
  • 1
  • 4
  • 15
2
votes
0 answers

How to resample nonperiodic signal with scipy?

The documentation for scipy.signal.resample says that it assumes the function is periodic. Is interp1d the equivalent function for nonperiodic signals? If not, what is? I've spent a lot of time searching for this and reading through other posts, but…
2
votes
0 answers

How do the following lines of code actually downsample chrominance of an image?

I'm trying to make a jpeg compressor and found a bit of code which supposedly donwsamples the chrominance of an image but I don't understand how it achieves this. x = 2 pic = imread("picture.jpg"); pic_ycbcr = rgb2ycbcr(pic); %convert rgb image to…
user11234959
2
votes
1 answer

Error: unknown format: 3 (When trying to read audio wavfile)

I am trying to clean and downsample my audio using the following functions displayed below. I get thrown into this error which I lack understanding of. Would anyone care to explain and hopefully help me resolve this issue? I can see that it has to…
Simiso Gwala
  • 21
  • 1
  • 2
2
votes
1 answer

How to downsample various snapshots to monthly average in Pandas

I have a data frame with cumulative sums for various time periods and I would like to uniformly downsample to the monthly average. Sometimes I have a yearly summary, which I want to downsample to 1/12, quarterly data downsample to 1/3, and monthly…
Vaasha
  • 881
  • 1
  • 10
  • 19
2
votes
1 answer

Stratified Sampling to mimic Population Distribution

I am new to R, I recently used stratified sampling for train and test split to ensure target label is in equal proportion for both now I want to use down-sample the training data such that the population distribution/ train distribution is similar…
Dexter1611
  • 492
  • 1
  • 4
  • 15
2
votes
1 answer

R-MLR : tuning hyper parameters using ' makeTuneControlRandom ' for a wrapped learner

Following my previous question and recommendations addressed in its comments, I was trying to find a proper value for the maxit argument of the makeTuneControlRandom function so that when I shrink the lower:upper interval the optimized hyper…
Basilique
  • 150
  • 1
  • 11
2
votes
2 answers

Balanced sample with defined n in R

I have an imbalanced dataset for sentiment analysis with about 65000 observations (~60000 positive and ~5000 negatives). This dataset should be balanced so that I have the same number of positive and negative observations to train my machine…
Oliver
  • 43
  • 3
2
votes
2 answers

How to down sample an array in python without a for loop

Is there a 'pythonic' way to cleanly down-sample without multiple for loops? This example below is the type of for loop I wish to get rid of. Minimum working example: import numpy as np unsampled_array = [1,3,5,7,9,11,13,15,17,19] number_of_samples…
Jesse Reza Khorasanee
  • 3,140
  • 4
  • 36
  • 53
2
votes
1 answer

How to efficiently convert large numpy array of point cloud data to downsampled 2d array?

I have a large numpy array of unordered lidar point cloud data, of shape [num_points, 3], which are the XYZ coordinates of each point. I want to downsample this into a 2D grid of mean height values - to do this I want to split the data into 5x5 X-Y…
Mark
  • 109
  • 1
  • 11
2
votes
1 answer

Python - Downsample using resample not using average/mean

Hy guys i must be missing something very obvious but, i have a datetime series with hourly rate. I need to downsample it to daily rate, which is pretty simple using resample('D'). But i cannont downsample it using mean. I need for example to choose…
joelmoliv
  • 53
  • 6
2
votes
0 answers

Need desired format of .wav In Recoder.js

I am using recorder.js to record audio. When I download .wav file it is 48KHz but I want in 16KHz, mono channel. function init(config) { sampleRate = config.sampleRate; //to 16000 numChannels = config.numChannels; //to 1 …
2
votes
0 answers

Postgres: Downsampling for every 2 hours?

I've been trying to downsample my data in postgres, to mimic the downsampling that python offers (using 'resample'). so far I've managed to do it for single units of time as: SELECT t,avg(data) FROM ( SELECT date_trunc('hour',"timestamp") as…
aswa09
  • 169
  • 1
  • 1
  • 10