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.
sampling
1,610
questions
0
votes
0
answers
4
views
Changing pick chance of multiple elements in weighted set
I have a weighted set implementation that works off a map in the data structure:
class WeightedSet<T> {
Map<T, Double> weights = new HashMap<>();
double sum;
}
This ...
0
votes
0
answers
29
views
create random sample conditionally using a file
I am trying to assign reviewers to projects with the condition that the author of the project cannot be assigned as a reviewer to a project in their own portfolio.
I created a dataset with variables ...
0
votes
0
answers
22
views
using mstage() in R to draw stratified samples
I trying to use the mstage() function in R to draw a multi-stage stratified sample and don't know how to. I wonder if anyone can help?
The data is in the end.
What I want to achieve is:
At the first ...
0
votes
0
answers
20
views
Monte Carlo Example using Accept Reject Method
I implemented a Pi estimation program in C, that is I generate a pair of PRNs using LCG algorithm, and then I compute their coordinates to see if they fall within a unit disk, as referenced here https:...
0
votes
1
answer
28
views
How to weight samples with sklearns's cross_validate for scoring only?
I am running a regression task on a dataset which is composed of both authentic and augmented samples. The augmented samples are generated by jittering the authentic ones. I would like to select the ...
0
votes
0
answers
16
views
Get specific number of samples from audio
I have an audio file and corresponding video (which were recorded synchronously) and I'd like to match up every frame of the video to a corresponding pitch using the praat-parselmouth package.
First, ...
0
votes
1
answer
41
views
How to use balanced sampler for torch Dataset/Dataloader
My simplified Dataset looks like:
class MyDataset(Dataset):
def __init__(self) -> None:
super().__init__()
self.images: torch.Tensor[n, w, h, c] # n images in memmory - ...
-1
votes
1
answer
46
views
Is it efficient to pass model into a custom dataset to run model inference during training for sampling strategy? [closed]
I'm trying to design a training flow for sampling samples during training.
My data look like this:
defaultdict(list,
{'C1629836-28004480': [0, 5, 6, 12, 17, 19, 28],
'C0021846-...
0
votes
0
answers
39
views
In statistical modeling: sampling with replacement or without replacement?
I want to sample a population with systematic and cluster sampling methods and use these samples in linear regression modeling. For this, should I do sampling with replacement or without replacement?
...
1
vote
1
answer
27
views
Sampling with Replacement/Bootstrap in Oracle SQL
This is my first question to the stack overflow.
We are doing statistics for simulation data and I wanted to implement the bootstrap in Oracle-SQL (sampling data with replacement). My approach is as ...
0
votes
1
answer
128
views
Efficient Equidistant Point Sampling on Closed Contours in OpenCV
For a project, I extracted closed contours from silhouette images (MPEG-7 Core Experiment CE-Shape-1 Test Set) using OpenCV’s findContours with RETR_EXTERNAL and CHAIN_APPROX_NONE. I need an efficient ...
0
votes
0
answers
61
views
Latin Hypercube sampling with constraints
I want to generate say about 500 samples of 36 variables using Latin Hypercube sampling to ensure good coverage of the parameter spaces.
I also want to ensure each sample meets some constraint.
from ...
1
vote
1
answer
52
views
Sampling transformation - rexp vs rweibull
I am working with different sampling functions, and I am wondering why these two formulations do not give the same result
n=2
set.seed(1)
rweibull(n,shape = 1,scale = 1)
# [1] 1.3261078 0.9885284
set....
0
votes
0
answers
26
views
Implementing Latin Hypercube sampling from skewed distributions in Java
I have 5 parameters represented by skewed discrete distributions. I want to do Latin Hypercube sampling from these distributions. Most of the examples I could find on the internet use LHS from normal ...
-1
votes
1
answer
28
views
Plot of the two dataset having different sampling rate with proper alignment
I have two dataset are the sensor values recorded with different equipment with different sampling rate. I want to plot both in same graph and it's peak should be aligned so that we can compare it ...
0
votes
0
answers
26
views
Ploting of the two dataset having different sampling rate
number of peaks I am getting is equal with dataset1 and dataset2 but since sampling rates are different for both data set .I am unable to plot such that its peak look aligned.
I want to optimise the ...
1
vote
0
answers
74
views
How do I simulate Bayes theorem in R to get a sense of uncertainty?
Okay, so Bayes theorem is p(A|B) = p(A) * P(B|A) * 1/p(B).
I want to simulate p(A|B) using all the uncertainty surrounding p(A), p(B|A) and p(B).
rbeta seems like a good choice.
data: imagine I just ...
0
votes
0
answers
68
views
Adafruit ESP32-C3 ADC sampling rate issue when sending real time sine wave
So we have this project which is about sending data using Adafruit QT Py ESP32-C3 Bluetooth module to another device and visualizing it, we are stuck at some point and we are facing a problem with the ...
0
votes
0
answers
25
views
Simulating Cox-PH data in Python
Suppose I want to sample from the cox-PH model. I have some covariates and my baseline hazard function is $2t$.
Is there are an easy method to do so?
0
votes
1
answer
29
views
How can I parameterize lags parameters for each independent variable in my model in PyMC (5.10.0)?
I am new to PyMC and I am using the 5.10.0 version. I am running a simple Media Mix Model and I need to parameterize the individual lags between the independent(media activity) and the dependent(sales ...
1
vote
1
answer
55
views
What's an elegant way to avoid "hopping" quantization errors when graphing a divergent 2D function?
I have some Qt-based software that graphs an audio-transform function in 2D (with frequency-in-Hz as the X axis, and decibels-gain on the Y axis).
It does this by choosing a set of X positions to ...
0
votes
0
answers
23
views
How many partitions should be used for a latin hypercube sample, versus computational time
I'm running a sensitivity analysis on an epidemiological model and I have 14 parameters which are uncertain.
I'm using the maximinLHS command from the 'lhs' package in R (Version 2023.06.1+524), and ...
0
votes
0
answers
14
views
Creating a tensor of samples from posterior predictive based on test data shaped differently than training data
How do I allow a pymc model to sample from a posterior predictive when a matrix of training data has shape (66289, 1024) and a matrix of test data has shape (2054937, 1024)? In other words, how do I ...
0
votes
0
answers
23
views
Domain error in arguments for iterated sampling from sequence of MM1 queue models
Here is my minimum working example:
import numpy as np
from scipy.special import iv
from scipy.stats import rv_discrete
class mm1_len(rv_discrete):
"Distribution of number of customers in a ...
1
vote
1
answer
84
views
The difference between using fft2 in matlab for odd and even matrices
I want to perform Fourier transform on a two-dimensional center-symmetric disk in matlab. The specific code is as follows.
N = 20;
matrix = zeros(N, N);
diameter = 20;
radius = diameter / 2;
...
0
votes
1
answer
46
views
R: sample equal Ns, within groups
I have a data set, in which observations are divided into groups and subgroups, and into types.
Here's an example of such data:
data <- data.frame(group = sample(c(1:30), 10000, replace = ...
1
vote
3
answers
69
views
Quasi-random equal assortment
I am trying to write a script to allocate moderators/second markers to essays that have already been marked but I am struggling to get it right.
There are two main conditions I have:
As the markers ...
0
votes
0
answers
11
views
Independent sampling with at least two elements, without re-sampling
Suppose we have a sequence of numbers (WLOG, [n]) and we want to sample elements from it into a set $S$, where each element is sampled independently at random with
$p_i := Pr[i \in S] \in (0, 1), for ...
0
votes
0
answers
58
views
How to Sample from a DataFrame in Pandas to Match a Target Distribution with Specific Variables
I'm working with a large DataFrame in Pandas, containing about 800,000 observations. I need to create a sample from this DataFrame that approximates a target distribution. The sample size should be ...
0
votes
0
answers
61
views
MaxMin diversity selection with RDKit
I cannot find a detailed exposition of the Leader algorithm used to perform MaxMin diversity picking. The documentation (https://www.rdkit.org/docs/source/rdkit.SimDivFilters.rdSimDivPickers.html) ...
2
votes
2
answers
60
views
Stratified sampling based on two population benchmark distributions
I am having trouble figuring out an existing way or writing new code to use stratified sampling from a dataset framework against two different population benchmark distributions. Since I am not 100% ...
2
votes
0
answers
22
views
Probability 0 in Importance Sampling
I have a general question about the methods that use importance sampling in RL. What happens when the probability of either one of the policies is 0?
1
vote
3
answers
75
views
Select random rows until threshold value from other column is reached
I have an SF-object in R. It looks as follows:
Type Value Geometry
A 1 ()
A 3 ()
B 2 ()
A 1 ()
C 4 ()
In the geometry column, the ...
0
votes
0
answers
18
views
pymc3 sampling chain 0 failed
I am trying to extract parameters for a model y=theta[0]*x+theta[1]*x**2. However when I run pymc3.sample after a short time the code crashes with an error message chain 0 failed. Any ideas how to fix ...
2
votes
1
answer
55
views
sample a predefined number of observations per group
My data looks like this:
> data|>head(20)|>dput()
structure(list(id = c("42190204", "34390202", "34310104", "34310104",
"34310104", "...
0
votes
0
answers
20
views
T-distribution, to use or to not use
The question is asking to find if probability of having average low or low as 18?
I have mu = 20, n = 25, X bar = 18, and std dev = 2
Since I do not have variance, I assume I am supposed to use t-...
0
votes
0
answers
28
views
Applying tail sampling policy on two seprate collectors- Aggregating spans
I'm using 2 separate collectors to send traces from my frontend and backend apps. One collector is receiving traces on port 4318 from the frontend app and the other collector is receiving traces on ...
1
vote
1
answer
78
views
How do I do a random sample of a specific number of cases of each value?
I have a data set with numerous cases of a dichotomous variable (0 or 1). Is there a way in SPSS to ask for a random sample of 500 cases with the value of 0 and 500 cases with the value of 1 (1000 ...
0
votes
1
answer
31
views
tms-NET sampling in Python
I have been trying find some pre-implementation of tms-NET sampling in python (as I couldn't implement by myself) for my projects wherein I want to perform sampling on numpy array of shape (...
0
votes
0
answers
34
views
Sampling from conditional distribution to impute NaN values in joint
Suppose that X and Z are sets of non-overlapping dimensions where $P(X,Z)$ is the joint distribution over all features. I have two sets of data:
X and Z are observed, and
only X is observed.
Given ...
-1
votes
2
answers
67
views
Random sampling of n lists of m elements in python
I wrote this code which creates all combinations of n lists of m elements in python, samples a given number of unique combinations (max possible or 1000) and outputs it in excel. It basically works, ...
0
votes
1
answer
31
views
Sample t-test inside a loop
I'm trying to mimic an experiment within a dataframe, running numerous simulations with t-tests to extract significance values.
I created the "treatment" variable within my dataset to ...
0
votes
1
answer
747
views
How to implement in-batch negative sampling in Pytorch?
I tried to train Two-tower model for recommender system using implicit dataset.
Before training, I want to preprocess dataset using in-batch negative sampling.
I think code is well, but performance is ...
0
votes
0
answers
40
views
Matlab interp signal length
Consider the simple Matlab script
t = linspace(0, 1, 11);
y = t.^2;
y_up = interp(y, 2);
The sampling frequency for y is 10 Hz (assuming t is in seconds). The length of y_up is 22. That does not make ...
0
votes
1
answer
127
views
Implementing a Gumbel sigmoid to restructure the data tensor
Suppose that we have a tensor(shape:B,W,1) of logits, each value representing a binary prediction that needs to be sampled and based on the output of sampling I want to add extra dimensions to data ...
1
vote
0
answers
86
views
Why does sampling of diffusion model diverge?
I'm encountering a divergence problem with the sampling process in my diffusion model, which I'm using to impute missing data (time-series). My model is based on Diffwave, CSDI, and DDPM with some ...
1
vote
0
answers
46
views
MIS path tracing got brighter image
I am currently implementing a Path tracer, and I want to implement the Multiple importance sampling which use two distributions (Light and BRDF) at each bounce to evaluate direct lighting
This is my ...
1
vote
0
answers
11
views
Sorting Time sampling results in GridDB
I am using GridDB, as GridDB's characteristics make it ideal for storing log data.
My patient data contains heart_rate and body_temperature , sampled every second or so, stored as a time series data.
...
0
votes
1
answer
55
views
mySql get N records in range
I have data logger acquiring temperatures aproximatly in 5 seconds interval (sometime data is missing like MQTT QoS 0). Each sample is stored in database with timestamp. That means 14400 records per ...
3
votes
0
answers
129
views
Antithetic Sampling for variance reduction in graph convolutional network (GCN)
I am trying to implement Antithetic Sampling to sample vertices of the graph and train the downstream graph convolutional network (GCN) model on the sampled graph.
Antithetic Sampling is a variance ...