# What do the terms 'Sample' and 'Sampling' mean in the discussion of Pattern Recognition and Machine Learning?

The tag sampling tells me that,

Creating samples from a well-specified population using a probabilistic method and/or producing random numbers from a specified distribution.

Now, the question becomes: what is population then?

Suppose, I am implementing a classifier.

I have a set of training data in the file train.txt, and a set of test data in the file test.txt.

What element can be termed as 'Sample', and what activity can be termed as 'Sampling' in this case?

## 1 Answer

Suppose that you're a pollster. You're trying to understand who will win the elections in Mars. What do you do? You sample a few eligible voters from the voter population, ask them for their preferences, and tally their votes. Sampling is not trivial, however, since your sample might not be representative, and so you might need to add in some weights when you tally the votes.

Here is another example. You're trying to understand the connection between lifestyle and longevity. You sample a few random people from the general population, and give them a questionnaire. Your goal is to create a formula that predicts life expectancy given some features of the person's lifestyle, such as whether they smoke or not.

The second example demonstrates the sort of problem that machine learning algorithms solve. Hopefully these examples give you enough hints to understand what sample and population mean in your context.