Questions tagged [sampling]

In signal processing, sampling is the reduction of a continuous signal to a discrete signal. In statistics, sampling is the selection of a subset of individuals from within a statistical population to estimate characteristics of the whole population.

This tag should be used for questions related to programming solutions related to sampling.

Sampling can be done for functions varying in space, time, or any other dimension, and similar results are obtained in two or more dimensions. More information in Wikipedia - sampling (signal processing).

For statistical sampling, see Wikipedia - sampling (statistics) for more.

1593 questions
0
votes
0 answers

How to create a sound signal vector by appending a vector to another vector in Matlab?

I'm trying to create a music piece by appending one vector to another vector. I create a row vector and trying to use sound(ct, 8000); to play the music, it throws error Cell contents reference from a non-cell array object. What should I do? This is…
Zhou
  • 31
  • 3
0
votes
3 answers

How to randomly sample p percent of users in user event stream

I am looking for an algorithm that fairly samples p percent of users from an infinite list of users. A naive algorithm looks something like this: //This is naive.. what is a better way?? def userIdToRandomNumber(userId: Int): Float =…
anthonybell
  • 5,790
  • 7
  • 42
  • 60
0
votes
1 answer

Update values of a matrix variable in tensorflow, advanced indexing

I would like to create a function that for every line of a given data X, is applying the softmax function only for some sampled classes, lets say 2, out of K total classes. In simple python the code seems like that: def softy(X,W, num_samples): …
Cfis Yoi
  • 241
  • 6
  • 15
0
votes
1 answer

How to store a Light sensor value in an array for a long time ? 1 sample / 2sec

I'm developing an app for a personal project , and I will need to process the data later on on Matlab (for power requirements). Hence, my goal would be to "store" a value of the light sensor every two second, in an array ? Right now, I am able to…
Sacha G.
  • 9
  • 1
0
votes
1 answer

Tensorflow sampled_softmax_loss example

Could someone give me a simple example on sampled_softmax_loss of the Tensorflow? I tried to change the softmax and the cross_entropy of the tutorial with the sampled_softmax_loss with different numbers for num_sampled but the results are really…
Cfis Yoi
  • 241
  • 6
  • 15
0
votes
0 answers

Drawing random samples from any distribution

I want to draw random samples from any given distribution. If I follow the rv_continuous documentation, I am able to draw samples from a relatively "easy" defined function such as class gaussian(ss.rv_continuous): def _pdf(self, x, mu, sigma,…
Harry
  • 145
  • 1
  • 1
  • 6
0
votes
1 answer

How to use sample weights with categorical data for visualization?

If one has a data set that looks as follows: data <- data.frame() data$gender <- c(F,F,F,M,F) data$province <- c(G,N,K,L,K) data$volume <- c(500,750,1250,NA,300) data$weight <- c(1.36,0.67,5.22,1.66,1.14) How do I apply these weights to the data…
ishido
  • 4,065
  • 9
  • 32
  • 42
0
votes
1 answer

Creating n samples from multiple datasets in SAS

I have 6 datasets, x201201,x201202,... and I'm looking for a way to make a random sample n=200, taken from the 6 datasets. I have been looking at proc surveyselect, but it only takes one dataset. I could make a temp set merging the 6 sets, but is…
Steffen Hvid
  • 187
  • 1
  • 10
0
votes
0 answers

I import a table in a txt.format to R but the output doesn't appears

I have an excel file with a table, which I transformed into a txt file. I try to upload this table to R using: df = read.table("nameofmyfile.txt", header = TRUE) I've searched in multiple websites and they all referred this formula. Also, I made…
0
votes
1 answer

R: Why won't my function create objects in my environment

I want to write a function that will create n random samples of a data set without replacement. In this example I am using the iris data set. The iris data set has 150 observations and say I want 10 samples. My attempt: #load…
Zyferion
  • 149
  • 2
  • 11
0
votes
1 answer

Playing MP3s in Python - Automatically handling varied sampling frequencies

I am writing a python program to practice and test my Mandarin oral comprehension. It selects a random mp3 from my designated directory and plays it (then does more stuff after). I am using pygame to play these mp3s, but my problem is my current…
Apollys supports Monica
  • 2,938
  • 1
  • 23
  • 33
0
votes
1 answer

Quickly sampling large number of rows from large dataframes in python

I have a very large dataframe (about 1.1M rows) and I am trying to sample it. I have a list of indexes (about 70,000 indexes) that I want to select from the entire dataframe. This is what Ive tried so far but all these methods are taking way too…
user324
  • 331
  • 1
  • 5
  • 15
0
votes
1 answer

Warning in rnorm and shiny: NAs produced

Has anyone come across and managed to solve an issue with sampling from normal distribution in Shiny R, please? I'm struggling to find a solution: this question was asked before but no answer was found. Sampling using rnorm results in output…
user2196886
  • 1
  • 1
  • 1
0
votes
1 answer

How to get the waveform with OpenSL ES?

Or even better, how to get the size of the amplitude or the volume of the wave sound every certain time. In fact I need the two ways, the full waveform and measure it each time. the first one for have a view of the song wave and the second one for…
quetzalfir
  • 528
  • 7
  • 22
0
votes
1 answer

symbian C++ downsizing libraries

I wish to record audio at 32 kHz on my Symbian device but it only supports 48 kHz. From searching the internet I believe the term for what I am trying to do is called downsizing. Is there a C++ library that will compile and run on Nokia Symbian…
user434541
  • 1,305
  • 2
  • 13
  • 21