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
32
votes
13 answers

How to incrementally sample without replacement?

Python has my_sample = random.sample(range(100), 10) to randomly sample without replacement from [0, 100). Suppose I have sampled n such numbers and now I want to sample one more without replacement (without including any of the previously sampled…
necromancer
  • 23,916
  • 22
  • 68
  • 115
31
votes
4 answers

How to generate a random list of fixed length of values from given range?

How to generate a random (but unique and sorted) list of a fixed given length out of numbers of a given range in Python? Something like that: >>> list_length = 4 >>> values_range = [1, 30] >>> random_list(list_length, values_range) [1, 6, 17,…
user63503
  • 6,243
  • 14
  • 41
  • 44
30
votes
7 answers

Dataframe sample in Apache spark | Scala

I'm trying to take out samples from two dataframes wherein I need the ratio of count maintained. eg df1.count() = 10 df2.count() = 1000 noOfSamples = 10 I want to sample the data in such a way that i get 10 samples of size 101 each( 1 from df1 and…
hbabbar
  • 947
  • 4
  • 15
  • 33
30
votes
5 answers

Sample n random rows per group in a dataframe

From these questions - Random sample of rows from subset of an R dataframe & Sample random rows in dataframe I can easily see how to randomly sample (select) 'n' rows from a df, or 'n' rows that originate from a specific level of a factor within…
jalapic
  • 13,792
  • 8
  • 57
  • 87
29
votes
3 answers

MediaScannerConnection produces android.app.ServiceConnectionLeaked

I'm using the MediaScannerConnection example code from the API Demos The snippet I'm using is: MediaScannerConnection.scanFile( context, new String[] { permFile.getAbsolutePath() }, null, new…
David Shellabarger
  • 1,523
  • 2
  • 15
  • 23
28
votes
4 answers

Is there an rtmp (protocol) URL anywhere on the internet I can test?

I'm building a video player in flash based on NetStream, and all I need to test it is a functioning RTMP url, but I cannot find a single one on the entire internet through google. Is anyone aware of any valid sample rtmp streams and their URLs that…
Triynko
  • 18,766
  • 21
  • 107
  • 173
24
votes
3 answers

How to get a sample with an exact sample size in Spark RDD?

Why does the rdd.sample() function on Spark RDD return a different number of elements even though the fraction parameter is the same? For example, if my code is like below: val a = sc.parallelize(1 to 10000, 3) a.sample(false, 0.1).count Every time…
Carter
  • 1,563
  • 8
  • 23
  • 32
23
votes
4 answers

.NET DDD Example

Can somebody point me towards a 'complete' DDD example developed on the .NET platform. Most of the examples I find feel 'incomplete'. I'd really like to see the DDD principles in action.
Ali Kazmi
  • 3,610
  • 6
  • 35
  • 51
22
votes
5 answers

Sample app for Rails 3?

Can someone point me to a solid sample app that shows how to use the new features and syntax of Rails 3? It's been answered before for earlier versions…
Jonathan
  • 16,077
  • 12
  • 67
  • 106
21
votes
4 answers

SQL random sample with groups

I have a university graduate database and would like to extract a random sample of data of around 1000 records. I want to ensure the sample is representative of the population so would like to include the same proportions of courses eg I could do…
Simon
  • 1,293
  • 5
  • 21
  • 39
20
votes
7 answers

Run NetBeans project just with ant

I have a sample code that was built with Netbeans. It has a build.xml file so I downloaded ant and try to run it. I've got this error message: ...... nbproject\build-impl.xml:76: Platform is not correctly set up For what I can see, this is fixed…
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
20
votes
9 answers

Your Favorite LINQ-to-Objects Queries

With LINQ, a lot of programming problems can be solved more easily - and in fewer lines of code. What are some the best real-world LINQ-to-Objects queries that you've written? (Best = simplicity & elegance compared to the C# 2.0 / imperative…
Joe Albahari
  • 30,118
  • 7
  • 80
  • 91
20
votes
1 answer

(Kestrel) K-combinator: why is it useful?

I have been taking up F# recently (my background is C#) and am reading the site http://fsharpforfunandprofit.com, which I am finding very helpful. I've got to http://fsharpforfunandprofit.com/posts/defining-functions/ which is the section on…
Richiban
  • 5,569
  • 3
  • 30
  • 42
19
votes
9 answers

spring MVC sample web app

I'm looking for an example Spring MVC 2.5 web app that I can easily: Setup as a project in Eclipse Deploy to a local app server (using Ant/Maven) There are a couple of example applications included with the Spring distribution ('petclinic' and…
Dónal
  • 185,044
  • 174
  • 569
  • 824
17
votes
3 answers

Import Confluence xml dump into Mediawiki

Is it possible to import a Confluence xml dump into Mediawiki? If so, any guidance will be appreciated. Thanks for you assistance!
Paul Thomas
  • 281
  • 5
  • 11