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.
1,557
questions
0
votes
0
answers
16
views
Random sampling of rows based on a catergorical column for n iterations in R then using mclust for clustering these dataframes
I have a dataframe where the samples are rows and columns are proteins, I have an additional categorical column which are the group names that the samples belong to :
Sample
Group
protein1
protein2
...
1
vote
1
answer
32
views
A query to perform sampling, choosing every 3rd row based on condition using postgres
I have a table containing the image id and score.
Table
A positive sample is the image id with the score closer to 1 and a negative sample is the image id with score closer to 0.
In order to sample we ...
-2
votes
0
answers
40
views
How to sample rows from a table with a specific probability?
I'm using BigQuery at my new position, and I'm totally new to SQL/BigQuery.
I'm testing a machine learning model and monitoring an A/B test with a different ratio, e.g., 3 vs. 10. To compare the A/B ...
0
votes
0
answers
29
views
Stratified random sampling (into 4 groups) from data frame
I have a data frame in the format
> head(daten_strat)
id age gender anxiety
1 7 40 2 7
2 3 53 1 8
3 4 40 1 4
4 1 62 2 8
5 5 60 2 ...
0
votes
0
answers
28
views
Systematic sampling
I want to run a systematic sampling on a large database. I want it to be a systematic sampling but I don't fully understand how this works in R.
I used this code to do the sampling, where data is my ...
1
vote
1
answer
17
views
How can I do Stratified sampling with proportionate size
I have a dataset named by "Tree_all_exclusive" of 7607 rows and 39 column, which contains different information of tress such as age, height, name etc. I am able to create a sample of 1200 ...
0
votes
0
answers
74
views
Stratified sampling by two columns
Creating dataframe
# Create a dictionary of students
students = {
'Name': ['Lisa', 'Kate', 'Ben', 'Kim', 'Josh',
'Alex', 'Evan', 'Greg', 'Sam', 'Ella'],
'ID': ['001', '002', '003',...
1
vote
0
answers
16
views
How to read contents of PC Sampling Continuous output (dat file)?
I am looking into the code samples provided in /usr/local/cuda-11.8/extras/CUPTI/samples/pc_sampling_continuous/. I am trying to get the PC stall reasons (from an executable) without modifying the ...
0
votes
0
answers
28
views
Elimination of need to retrain models in "Shaply Sampling Values"
While reading the paper "A Unified Approach to Interpreting Model
Predictions" by Lundberg and Lee (https://proceedings.neurips.cc/paper/2017/file/8a20a8621978632d76c43dfd28b67767-Paper.pdf),...
0
votes
2
answers
44
views
Random selection of value in a dataframe with multiple conditions
Let's say I have a dataframe like this.
import pandas as pd
import numpy as np
np.random.seed(0)
df = pd.DataFrame(np.random.choice(list(['a', 'b', 'c', 'd']), 50), columns=list('1'))
print(df....
1
vote
1
answer
60
views
Which Rust RNG should be used for multithreaded sampling?
I am trying to create a function in Rust which will sample from M normal distributions N times. I have the sequential version below, which runs fine. I am trying to parallelize it using Rayon, but am ...
1
vote
1
answer
36
views
How does the R Survey package compute bootstrap confidence intervals?
I'm wondering how to use replication weights and the confint implementation of the survey package to construct bootstrap confidence intervals/standard errors.
Looking at the survey package's ...
0
votes
0
answers
65
views
function to sample based on several conditions
I am trying to prepare a function/loop which would sample a number of rows based on conditions.
I have two dataframes, the first one is a dataframe with day dates, people and their roles.
library(...
0
votes
0
answers
20
views
how to parse the data written in the ring buffer by perf_event_open() under sample mode?
I am new to perf_event_open(), and I have several questions;
So I am trying to collect addresses of pages that triggers MEM_LOAD_RETIRED.L3_MISS and MEM_INST_RETIRED.ALL_STORES for mysqld under ...
0
votes
0
answers
19
views
How can I get the time at which the audio from the microphone is received by the computer using sounddevice callback?
SO I want to get the following times:-
t_0 = the time at which the microphone is triggered by the python code
t_1 = the time at which the microphone starts recording
t_2 = the time at which the ...
0
votes
1
answer
26
views
Does as.svrepdesign inherit the fpc from a svydesign object?
I'm slightly confused by the as.svrepdesign function's use of the fpc from a design object.
The example from the documentation shows the following:
## one-stage cluster sample
dclus1<-svydesign(id=~...
0
votes
0
answers
34
views
Error while performing ridge regression with dummy variables
I'm new to R and I'm analyzing a dataset with qualitative and quantitative variables.The dataset is this one. I want to perform a Ridge regression, so I did this:
library(caret)
set.seed(3)
...
0
votes
0
answers
26
views
Different datasets and different loss terms in pytorch
I am working on a problem where the input space has different regions: R1, R2, and R3, and I have three datasets (D1, D2, and D3) sampled from the corresponding regions. The trick is that the loss ...
0
votes
1
answer
81
views
Cannot turn off sampling of application insights
I have a DotNet 6 application ASP.NET Web API application that is running as an App Service in Azure.
I do not have fixed sampling enabled. I also do not have applicationinsights.json file in my ...
0
votes
1
answer
28
views
Taking two samples from the data but with different observations
My data is made of about 9000 observations and 20 features (Edit - Pandas dataframe). I've taken a sample of 200 observations like this and conducted some analysis on it:
sample_data = data.sample(n = ...
0
votes
0
answers
6
views
Creating the same distribution
Dears, I have some target and control groups, target is 100,000 and control is 10,000. The both are representive to each others based on predious month ARPU of users. Target groups received discount ...
-1
votes
1
answer
28
views
SQL- Sample the 3rd from the beginning and backwards
I have a table with id and score. I want to create a new set of data with a sampling method. The sampling method would be to order the id in decreasing order of the scores and sample the 3rd id, ...
0
votes
0
answers
27
views
Device collects data less than sampling rate sometimes
I am using a device to capture the ECG data at the sampling rate of 1000. For some seconds, the collected data is not even 500. Is it normal? If yes, do I need to calculate the new sampling rate from ...
0
votes
1
answer
34
views
Weighted Sampling with Limitations
I am wondering if it is possible to do a weighted sample on a population where the sample can not contain certain people but I would still like to consider the excluded people in the population ...
0
votes
0
answers
89
views
how to read f32 audio samples from microphone in rust cpal library? trying to decode DTMF signals in realtime
I am trying to decode dtmf signals using rust in real time, and I have a working example that decodes them from wav files. But I am trying to do it in real time from the soundcard, by providing data, ...
0
votes
0
answers
24
views
Having trouble with Amplitude Modulation and creating proper graphs to go with it
I am a college student working on a Amplitude Modulator that switches modulation constants every so often. The problem I am running into is when I plot my carrier signal graph I get this weird line ...
0
votes
1
answer
16
views
Randomly sample from panel data by 3months periods
I have pandas data frame that is panel data i.e. data of multiple customers over a timeframe. I want to sample (for bootstraping) a continuous three months period (i always wanna get a full month) of ...
0
votes
1
answer
63
views
Function slice_sample gives error cannot take a sample larger than the population
I have a dataframe of cell barcodes (V1) and cell types (V2), I want to randomly sample 1000 of each cell type, unless there are less than 1000 total then all should be selected.
However slice_sample ...
0
votes
1
answer
30
views
Extract covariance from data frame in a loop
sample_size <- 200
sample_meanvector <- c(3, 4)
sample_covariance_matrix <- matrix(c(2, 1, 1, 2),
...
2
votes
0
answers
56
views
PyGAD: How to constrain genes to sample set without replacement?
Suppose I have an assignment problem where I need to assign riders to seats. I need to enforce the constraint that at most, one rider is assigned to any given seat and every rider is assigned one seat....
0
votes
1
answer
79
views
Does sampling rates of sensors change when update the API version on the same device?
As in the title, I am wondering whether the pre-defined sampling rates of sensors could change when I updated the android version on my device from API 26 to API 28, for example?
In detail, assume I ...
1
vote
1
answer
32
views
How to sample rowname-colname pairs from a crosstab (or dimname groups from an n-dimensional array) in R?
In R it is quite trivial to "collapse" an n-dimensional array into a one-dimensional column vector and sample from that using e.g. sample() function in base R.
However, I would like to ...
0
votes
0
answers
64
views
How to define "sampling_strategy" in SMOTE and RandomUnderSampling for Multiclass Classification problem?
I am solving a multiclass classification problem using LinearSVC() where each class has the following samples (training data)
Counter({7: 4799, 6: 4713, 4: 4448, 3: 419, 2: 405, 5: 324, 0: 214, 1: 64})...
0
votes
1
answer
86
views
.NET Application Insight logs sampling how to set to specific files extensions
i've just written web app in ASP.NET that sends lots of logs to Application Insight.
I want to set adaptive sampling on requests that are send to my application, because of huge amount of them. ...
0
votes
1
answer
25
views
How to generate samples from distribution function of data points by PyMC3
I have a density distribution function from data, which means that I cannot express its analytical form. If I want to generate 1000 samples by this distribution function, what should I do. It seems ...
0
votes
0
answers
20
views
Generating multiple sets of n samples from data set where standard deviation of each set is minimized
I prepared a dataset and later learned that it is skewed.
Assuming a plot of user_count vs score where user_count is the number of users on that particular score.
I have to sample out the total users ...
1
vote
1
answer
23
views
Sampling non-repeating integers with given probability distribution
I need to sample n different values taken from a set of integers.
These integers should have different occurence probability. E.g. the largest the lukilier.
By using the random package I can sample a ...
0
votes
0
answers
8
views
Scipy signal sample with time difference on same graph
I have a continuous signal that I want to sample and plot them together.
I tried using scipy.resample but it gives me an interpolation and lines connecting the signal at the sampled points, but I want ...
0
votes
1
answer
29
views
Determining the splitting ratio when augmenting image data
I have an image dataset that is quite imbalanced, with one class having 2873 images and another having only 115. The rest of the classes have ~250 images each. For reducing the imbalance, I decided to ...
0
votes
0
answers
39
views
pymc3 chain reaching maximum tree depth
I am building a model for using comparisons between pairs of deals as input to estimate weights that define the value function of the ranking party. Maybe this sounds like gibberish, but my question ...
0
votes
0
answers
52
views
PyTorch dataloader: Sample a batch of two with condition
I have a data set which consists of multiple sequences (e.g. s1, s2, s3, ...) with multiple items each (i11, i12, i12; i21, i22; i31, i32, i33; ...).
My goal is to use the DataLoader or Sampler of ...
0
votes
0
answers
53
views
Reservoir Sampling, except I can't hold the sample in memory
Is there an algorithm such as Reservoir Sampling (algorithm that randomly chooses an item from a stream such that each item is equally likely to be selected), but once an item is selected it is ...
0
votes
0
answers
29
views
Sampling from dataset A based on the distribution of dataset B variables
I have a big dataset A (100k rows) with 3 variables: Customer Type, Type of Travel, Class with the percentages below:
DATASET A:
Loyal Customer 0.817132
disloyal Customer 0.182868
Name: ...
0
votes
0
answers
7
views
Latic Hypercube Sampling from categorical distributions in Python
I have 3 lists including categorical values. I want to generate an array of 10 samples of combinations of values of three lists using hypercube sampling. I don't want full factorial combinations but ...
-1
votes
1
answer
27
views
Extract all possible combinations of unique elements in dict of lists
I have this input:
d = {'a': ['A', 'B', 'C'], 'b': ['A', 'B', 'C'], 'c': ['D', 'E'], 'd': ['E', 'F', 'G']}
How can I extract all the possible unique samplings per list?
One of the possible output is ...
1
vote
1
answer
38
views
How to randomly sample from a datafframe while preserving the distribution in Python?
I am using a Kaggle sample data. As shown bellow, 40% of the location is in CA and 47% of the category includes FOODS. What I am trying to achieve is to randomly select data from this data frame, ...
1
vote
0
answers
16
views
Is there a correct way to uniformly quantize a color map?
For general purpose visualization of continuous fields. For example, if you wanted to make a contour plot with 3 colors from a continuous color map, would you:
A) Use 3 equal-sized bins, each mapped ...
0
votes
0
answers
13
views
Generating simulated samples from GBS using Strawberryfields
I am using the Strawberryfields function
sf.apps.sample.sample(A, n_mean, n_samples, threshold, loss)
to generate simulated samples from GBS using threshold detectors. I would like to work without ...
0
votes
0
answers
17
views
How can I take multiple samples of parameters stored in a dataframe?
I need to take 1000 samples and have them stored as 1000 dataframes of sets of sample data
My code is this:
datadf = {"x1": x1,"x2":x2, "u": u, "y": y}
datas = ...
0
votes
0
answers
66
views
Google Analytics (GA4) transaction data not accurate
1. Background
Using GA4 without GA360
2. Description
When i want to search the records by transactional level (Record by datetime) which will show the detailed record one by one, the event count is ...