Questions tagged [sample]

Small part of or a selection from something (code, logs, data etc.), intended to show the structure, style, or nature of the whole.

In statistics, the process of generating random samples is called .

In and some other programming languages, the function sample performs random sampling of a set with or without replacement.

1672 questions
16
votes
7 answers

How to randomly sample from a Scala list or array?

I want to randomly sample from a Scala list or array (not an RDD), the sample size can be much longer than the length of the list or array, how can I do this efficiently? Because the sample size can be very big and the sampling (on different…
Carter
  • 1,563
  • 8
  • 23
  • 32
15
votes
2 answers

Sample project plugin jquery File Upload plugin implemented in ASP .NET MVC3

I need to implement in my project ASP .NET MVC3 the jQuery file upload plugin: http://blueimp.github.com/jQuery-File-Upload/ I have been Googling and I haven't found a whole project, only pieces of code. I don't know how to implement it. Can someone…
rspaz16
  • 207
  • 1
  • 2
  • 8
15
votes
3 answers

Shuffle Vector in R, But Identical Elements Should Have Minimum Distance

I want to randomize/shuffle a vector. Some of the vector elements are identical. After shuffling, identical elements should have a minimum distance of three (i.e. two other elements should be between identical elements). Consider the following…
Joachim Schork
  • 2,025
  • 3
  • 25
  • 48
15
votes
1 answer

`sample()` gives different values with same `set.seed()`

I was creating some random samples and plotting them and noticed a strange behavior. Sampled values were different after loading ggplot2: set.seed(111) library(ggplot2) sample(1:10, 10) # [1] 8 4 5 3 7 1 6 2 10 …
N8TRO
  • 3,348
  • 3
  • 22
  • 40
15
votes
3 answers

How to convert sample rate from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16?

I am decoding aac to pcm with ffmpeg with avcodec_decode_audio3. However it decodes into AV_SAMPLE_FMT_FLTP sample format (PCM 32bit Float Planar) and i need AV_SAMPLE_FMT_S16 (PCM 16 bit signed - S16LE). I know that ffmpeg can do this easily with…
frankish
  • 6,738
  • 9
  • 49
  • 100
15
votes
3 answers

jQuery-Mobile Meteor sample integration and/or integration guidelines

I'm impressed by Meteor and would like to use it with jQuery-Mobile. I'd like to know if somebody has already built a sample integration app. If not, some guidelines would be great. Regards, Cédric
Cédric Vidal
  • 153
  • 1
  • 5
14
votes
3 answers

Random sample of rows from subset of an R dataframe

Is there a good way of getting a sample of rows from part of a dataframe? If I just have data such as gender <- c("F", "M", "M", "F", "F", "M", "F", "F") age <- c(23, 25, 27, 29, 31, 33, 35, 37) then I can easily sample the ages of three of the…
Henry
  • 6,704
  • 2
  • 23
  • 39
14
votes
2 answers

What happens when prob argument in sample sums to less/greater than 1?

We know that prob argument in sample is used to assign a probability of weights. For example, table(sample(1:4, 1e6, replace = TRUE, prob = c(0.2, 0.4, 0.3, 0.1)))/1e6 # 1 2 3 4 #0.2 0.4 0.3 0.1 table(sample(1:4, 1e6, replace = TRUE,…
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
14
votes
2 answers

Looking for Webstart Maven Plugin sample application

I am looking for source code for a complete application that uses the Webstart Maven Plugin. Any ideas?
Ralph
  • 31,584
  • 38
  • 145
  • 282
13
votes
3 answers

Pandas sample with weights

I have df and I'd like to make some sampling from it with respect to distribution of some variable. Let's say df['type'].value_counts(normalize=True) returns: A 0.3 B 0.5 C 0.2 I'd like to make something like sampledf =…
Bear
  • 338
  • 1
  • 3
  • 11
13
votes
3 answers

Android Navigation Drawer bug using the sample

I'm trying to implement the navigation drawer pattern based on my app. I downloaded the sample code from here and i ran it and 90 % of the times the drawer works ok, but sometimes the drawer gets stuck when i try to open it. I have a way of…
xlar8or
  • 601
  • 9
  • 18
13
votes
2 answers

{ Qt5.0.2/QML/QtQuick2.0/C++ } Example Projects that run without errors?

My setup is Qt5.0.2 MinGW 32-bit. I am looking for { Qt5.0.2 / QML / QtQuick2.0 / C++ } code project examples (not Qt Quick 1.0) that have actual C++ classes or at least a main.cpp . I ran through the web, browsed all examples I could possibly…
iviv
  • 161
  • 1
  • 1
  • 7
12
votes
1 answer

How to do one-way ANOVA in R with unequal sample sizes?

Trying to learn R. A question from an old stats text want's to know if there is a difference in break times at different construction sites. Trouble is, the text decided that each site employs a different number of workers. So, I am stuck and…
tora0515
  • 2,479
  • 12
  • 33
  • 40
12
votes
4 answers

Why does reading an image from OpenCV python samples giving error where as it does not give error in c++?

I am trying to read an image in opencv python import cv2 import numpy as np # Read images image=cv2.imread(cv2.samples.findFile("lena.jpg")) cv2.imshow("image",image) cv2.waitKey(0) and it gives the following error [ WARN:0] global…
Gourav Roy
  • 163
  • 1
  • 2
  • 5
11
votes
1 answer

Can Web Components be used to create custom input elements?

How is it/(or just "is it?") possible to create a Web Component that can be placed inside a form and act just as any input element, that's sent to the server on submit? In other words, can Web Components be used to create custom input elements?