Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
2 votes
0 answers
78 views

How to uniformly sample from a nonlinearly transformed simplex?

The following algorithm is intended to uniformly sample priority (or criterion) vectors from a transformed version of the simplex (which is a surface in 3d space). The transformation involves taking ...
Engr. Moiz Ahmad's user avatar
0 votes
0 answers
49 views

Sampling characteristics of nRF52840 SAADC

According to the documentation, the SAADC (ADC) device has a maximum sampling rate of 200kHz (ksps), a value that is the sum of a minimum TACQ (acquisition time) of 3us and a conversion time of "&...
Olof Forshell's user avatar
0 votes
0 answers
74 views

Implement a Custom Sampler in Mitsuba

I am trying to implement a basic custom sampler, and here is the code that I have been working with. As I attempt to render the scene, I encounter an error stating that the traverse() method is not ...
Shreyas Shivakumara's user avatar
4 votes
3 answers
165 views

How to consistently retain an exact percentage of elements from a List in Java?

I'm currently filtering a Java List to keep approximately a percentage of its elements using a random approach: import java.util.List; import java.util.Random; public class Main { public static ...
user30654079's user avatar
1 vote
1 answer
56 views

Sampling from discrete probability distribution over all natural numbers

I'd like to sample a from the distribution c^a / (-a log (1-c)) where a is a natural number (1 to infinity) and c < 1. How can I do this in Python? I've looked at scipy.stats.rv_discrete, but it ...
serene's user avatar
  • 13
1 vote
2 answers
75 views

Sampling with replacement in Rust

The following snippet samples elements with replacement from a vector: use rand::seq::IteratorRandom; fn main() { let mut rng = rand::rng(); let values = vec![1, 2, 3, 4, 5] as Vec<i32>;...
Roger V.'s user avatar
  • 803
2 votes
3 answers
265 views

Stratified sampling using SQL given an absolute sample size

I have the following population: a b b c c c c I am looking for a SQL statement to generate a the stratified sample of arbitrary size. Let's say for this example, I would like a sample size of 4. I ...
Saqib Ali's user avatar
  • 4,551
3 votes
2 answers
175 views

What is causing some points to fail sampling an enclosing mesh? / How do I prevent points from failing to sample an enclosing mesh?

I am using the PyVista package to resample a .vtk mesh of nonconforming rectangular prisms onto a grid of points. However, some of the points fail to sample the dataset, which results in a "0&...
oaazeved's user avatar
0 votes
0 answers
39 views

How can I plot information from Adafruit ADS1115 smoothly on matplotlib using python

See attached my waveform of input to channel of ADS1115, my code, and my output that I am getting I cannot get the output matplotlib waveform to plot smoothly like my input waveform from oscilloscope ...
Marc Rainey's user avatar
1 vote
1 answer
52 views

Stratified sampling based on multiple predictors in R

I have a dataset with two groups of people: vaccinated and unvaccinated. In the vaccinated group, each row represents a unique ID with a corresponding unique T0. In the unvaccinated group, each ID may ...
Miao  Cai's user avatar
  • 1,054
0 votes
0 answers
33 views

Correcting sampling bias (looking for data science or statistical approach)?

Lets say I am looking at a sample of students and their grades achieved across 5 subjects. 90% of my sample is biased towards worst performing students and 10% of my sample is random. What is a simple ...
Alexander Churakov's user avatar
0 votes
1 answer
84 views

How to sample point using LatinHyper Cube sampling in a random volume

I have a a dataset composed of XYZ coordinates, which can be rendered in 3D bar chart as the picture below. The main question I have is: how to generate X points (X being a user input) inside said ...
Ryderc's user avatar
  • 109
1 vote
1 answer
49 views

Sampling from joint probability mass function in python

I have a non-negative normalized vector p. I would like to sample an index from the index set of the vector. The probability getting sample k is p[k]. Using np.random.choice function, I can write the ...
Sakurai.JJ's user avatar
1 vote
2 answers
177 views

How to sample values based on probabilities with Polars like numpy.random.choice?

I'm working with the Polars library in Python and would like to sample values from a list based on associated probabilities, similar to how numpy.random.choice works. Here's what I'd like to achieve: ...
Pedro_Siqueira's user avatar
0 votes
1 answer
89 views

How to save survey designed dataset for other analysis (preferred R)

Is there any way to save weighted survey with strata and fpc as dataframe? For example, here is the simple dataframe: Data <- data.frame( X =c(1,4,6,4,1,7,3,2,2), Y = c(6,5,9,9,43,65,45,67,90), ...
Kammy Deng's user avatar
1 vote
2 answers
96 views

How to generate a sample with a given spearman coefficient

In order to create a dataset to test a statistical calculation package, I want to be able to generate a sample that is correlated to a reference sample with a given searman coefficient. I managed to ...
BayesianMonk's user avatar
0 votes
1 answer
118 views

Inconsistent numbers of samples error in multi-class / multi-label machine learning model

I have a OneVsOne model running fine with textual feature and target fields. To progress to a multi-class model (i.e. with multiple textual feature fields), I believe OneVsRest with Logistic ...
ChrisTeBurg's user avatar
0 votes
2 answers
111 views

How to randomly sample a dataset with specific constraints on two boolean conditions by Python?

I'm working with a dataset of 2,500 samples, and I need to extract a random subset of 666 samples while meeting specific conditions based on two boolean columns. The dataset (df) contains the ...
taiyaki's user avatar
  • 13
2 votes
1 answer
168 views

Triple integral in Python

I am attempting to write a function which should solve the integral The data points that are used follow a Power-law proces and can become quite large numbers. The data is simulated using the code, ...
TK99's user avatar
  • 143
0 votes
0 answers
88 views

Implementing Gibbs algorithm in Python

I am trying to implement the approach used by the paper 'On Modeling Change Points in Non-Homogeneous Poisson Processes' by F. Ruggeri and S. Sivaganesan. In their paper they define the full ...
TK99's user avatar
  • 143
1 vote
1 answer
203 views

ITelemetryProcessor uses 5% total CPU - log filtering in dotnet-isolated azure function

I have the following telemetry processor: public class ExcludeInProcInvokeTelemetryProcessor(ITelemetryProcessor next) : ITelemetryProcessor { private readonly ITelemetryProcessor _next = next; ...
yggdrasiljsp's user avatar
0 votes
1 answer
51 views

Cannot understand profiling results for my Anylogic model [closed]

I have made a big Anylogic model with fluid library, and I see that it’s work not fast. I tried to make a profiling with sampling , and it’s shows me that many time used to some Tank is anylogic own ...
QQYu's user avatar
  • 11
0 votes
1 answer
364 views

Top-p sampling not working. CUDA error: device-side assert triggered

I was trying to re-implement the model.generate() function of transformers' models from huggingface. I did that so I could implement logit-bias, that normal function does not allow. But before I could ...
AndreiS's user avatar
  • 11
0 votes
2 answers
78 views

How to sample evenly from a data frame having only one representative per group?

This is the data frame I am using and I am trying to subsample column V2(position) evenly (min:1130, max: 4406748) in a way that there is only one representative of column V4(lineage) in the final ...
Mary's user avatar
  • 51
4 votes
1 answer
415 views

slice_sample producing different samples in grouped .data

Why do the following grouping methods results in different samples. My assumption was that the grouping results to similar samples? small <- data.frame( id = 1:100, gender = rep(c('male', '...
B.M Njuguna's user avatar
0 votes
1 answer
111 views

Sampling in python with multiple conditions and percentages

Person ID Condition 1 Condition 2 Condition 3 A Yes No Yes B No Yes No C Yes No No Hi! I have to generate a sample from a fairly large dataset, and the inclusion criteria are a little more complicated ...
user avatar
2 votes
1 answer
106 views

Random stratified sampling in pandas

I have created a pandas dataframe as follows: import pandas as pd import numpy as np ds = {'col1' : [1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,3,4,4,4,4,4,4,4,4,4], 'col2' : [12,3,4,5,4,3,2,3,4,6,7,8,3,3,...
Giampaolo Levorato's user avatar
1 vote
1 answer
55 views

sampling one row from each strata to emulate the distribution of a variable in r

I have a data da that has some date frequency distribution (see below). I have another data db, in which each id may have one or multiple records. Is there a feasible way to get one record (no more ...
Miao  Cai's user avatar
  • 1,054
1 vote
0 answers
54 views

GMM in R using sampling weights

I want to perform GMM in R and specify sampling weights but I do not know how to do it. I am using gmm from gmm package and all weight options are about weighting matrix of GMM estimation. Can you ...
Hanifa Pilvar's user avatar
1 vote
1 answer
347 views

Application insights misunderstanding sampling data

I'm trying to understand the sampling data. And I can't seem to find the exact wording anywhere. Sometimes I just happen to not have all the logs from my application in the traces. I have treated to ...
Katarina's user avatar
1 vote
0 answers
42 views

representative value of a distribution for Monte Carlo simulation

I have a monte carlo simulation that samples three independent variables from their respective (continuous and skewed) distribution. I need to fix one variable and only sample from the other two ...
Behzad Jamali's user avatar
0 votes
1 answer
253 views

Firth's model stuck (with non-converge warning and CPU usage 99%) in R using the logistf package

Here is the process of creating the datasets. I saved in both rds and csv format in case any internal data characteristics changes during the saving process: # Save the data frame saveRDS(...
LCheng's user avatar
  • 400
0 votes
0 answers
30 views

Firth's model in R "missing values in resampled performance measures"

Here is an example with sample data library(caret) library(logistf) library(data.table) library(ggplot2) # Create a synthetic dataset set.seed(123) n <- 100 data <- data.table( predictor1 = ...
LCheng's user avatar
  • 400
1 vote
1 answer
68 views

Mystery bug in sampling for loop in R

I am trying to understand what is causing this bug in my R code and I feel like R is gaslighting me. The sample() function seems to change depending on how I assign it? Anyways, here is the MRE: #...
ssm1020's user avatar
  • 45
0 votes
1 answer
50 views

Determine time that minimum value occurred using Google Sheets

I have a set of sampled data consisting of date/time of sample and sample value for a number of days. I would like to determine the time at which the minimum value for each day is measured: Datetime ...
pdv2001's user avatar
  • 25
0 votes
1 answer
584 views

How to use Open3D to sample point clouds to ensure that the results are the same every time

I'm using Open3D in Python to sample 1000 points on the same .obj file to get a point cloud. But every time you process the same .obj file, you end up with a different point cloud. Is there a way to ...
hu changpan's user avatar
1 vote
1 answer
64 views

Get even sample of data using spark

Here is my dataset schema: request_type | request_body 1 body A 2 body B 3 ... 4 5 6 .. 32 body XXX I need to get 500 records in total. there are 32 ...
Capacytron's user avatar
  • 3,818
0 votes
2 answers
43 views

Replicate a procedure: generate m dataframes, each one with a variable that includes random values, and append them, in R

Which is the most efficient way to generate m dataframes, where each one has a variable that includes random values, and append them? Here's an example: df <- data.frame(id = 1:10, var = sample(1:...
jeff's user avatar
  • 335
0 votes
0 answers
208 views

Efficient random voxel sampling with PyTorch

I am trying to implement a fast sampling algorithm for point clouds. The idea is to overlay a regular grid over the point cloud and cluster all points within the same voxel. I do this with the ...
Costas's user avatar
  • 1
0 votes
0 answers
159 views

PyMC sampling getting nan or -inf from model sampling

I am getting a -inf or nan value from my PyMC model and wanted some help to debug it and figure out where the problem is. Here is my model: # -----------------------------------------------------------...
Rvdb's user avatar
  • 11
0 votes
1 answer
258 views

Weighted Random Sampling by Group Variable in Excel?

I am trying to figure out how to randomly sample IDs matching a group variable, but specifically randomly sampling by weighting each grouping variable. For instance, take this data: I want to weight ...
halowiz's user avatar
  • 25
0 votes
0 answers
37 views

How to sample rows of dataset repeatedly based on a certain column in R? [duplicate]

Consider the following dataset: df <- data.frame(id = c(1,1,1,1,1,2,2,2,2,2), v1 = c(1,2,3,4,5,6,7,8,9,10)) My intention is to sample randomly (with replacement) rows of size n=3 ...
iGada's user avatar
  • 643
3 votes
2 answers
84 views

Integers into random order with constraints in R?

I want to sample integers in R, but also set constraints that for example, "3 comes always before 2" and "8 comes always before 5". EDIT: The integers need not to be next to each ...
Aku-Ville Lehtimäki's user avatar
0 votes
0 answers
212 views

scipy.signal.resample vs Ramer Douglas Peucker

The graph data is loaded from a wave file and only 1600 samples are used. For resampling, I have used resampled_audio_data = scipy.signal.resample(audio_data, len(audio_data) // 10) Here is the code ...
Prashant's user avatar
  • 947
0 votes
0 answers
39 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 ...
Jeaniewiththelightbrownhair's user avatar
0 votes
0 answers
62 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 ...
zeming's user avatar
  • 1
1 vote
1 answer
436 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 ...
majpark's user avatar
  • 103
0 votes
1 answer
680 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 - ...
Mateusz Konopelski's user avatar
-1 votes
1 answer
128 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-...
jupyter's user avatar
  • 351
1 vote
1 answer
129 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 ...
WedgeCountry's user avatar

1
2 3 4 5
33