Data: From Business Records To Model Inputs · Lesson 8

Sampling And Selection Bias Explained

Follow the collection path before extending a result to a population. More rows cannot automatically repair systematic exclusions or repeated evidence.

Study And Save Progress

Watch The Lesson

6 min 26 sec

Read the video transcript

Our fictional returns assistant has 100 distinct interaction IDs for the stated period. Each interaction can supply at most 1 eligible rating. 20 interactions have a rating, and 16 of those ratings are positive. The team calls this 80% satisfaction and proposes learning from the praised answers. Follow which interactions reached the feedback

collection and which remain outside it before deciding what this result can support. A dataset is produced by a collection process. That process decides which cases have a chance to appear, which actually appear, and which survive later filtering. The target population here is all 100 distinct service interactions in the period. The observed feedback covers 20 distinct rated interactions.

16 divided by 20 gives 80% positive among the rated interactions. The other 80 interactions are unrated. A customer could have several interactions, so these counts do not establish the number or satisfaction of distinct customers. People may choose to rate some interactions and leave others unrated for different reasons.

Their experience might be unusually pleasing or frustrating, or the rating route may be easier to use for some interactions. We have not measured which explanation applies. Selection bias arises when included cases differ systematically from the relevant population in ways that affect the conclusion. A large voluntary collection can

preserve that problem as it grows. Statistics Canada explains volunteer sampling as a non-probability method and warns about generalizing from self-selected respondents. Its discussion concerns survey inference. We are applying that reasoning to a service feedback route, without claiming that this company's rating process has been studied. Inspect how the invitation is offered,

who can respond, and whether unresolved or abandoned interactions can enter the collection. Coverage includes more than customer counts. Suppose every response in this extract concerns a completed daytime interaction in 1 supported language. The intended service also handles incomplete requests and other operating conditions. Success in the included cases leaves those missing conditions untested.

Ask which people, languages, tasks, environments and periods are relevant. Equal numbers in every group are not automatically the right design; the question, risks and intended inference determine the comparison. A NIST study released on December 19, 2019 tested face-recognition algorithms across demographic groups. Most tested algorithms showed differences, with results

depending on the algorithm, application and input data. The researchers did not determine what caused those differences. This is a reason to examine performance for relevant groups and tasks, rather than infer it from 1 overall result. It does not prove that a particular training imbalance caused the results, or tell us how large a difference our returns service would show.

Consider a rare but consequential unauthorized-order request. An evaluation may deliberately include extra examples to test whether the access path holds. That is useful stress testing. Its fraction of the test set is then a design choice, not an estimate of how often such requests occur in production. Report that test separately or use a

defensible aggregation method for the population claim. No operating rate or acceptable error threshold is supplied here. Weights can adjust some analyses when inclusion information and the necessary assumptions are credible. They cannot reveal the answer behavior of an entirely missing condition by arithmetic alone. If there are no relevant night-time cases, giving daytime cases more weight

does not observe the missing behavior. Improve the collection or run a suitable additional test, with appropriate permission. Statistics Canada's account of systematic errors also explains why simply increasing sample size does not remove a persistent selection problem. Repeated answer content creates another trap. The 20 rated interactions still have distinct interaction

IDs and at most 1 eligible rating each. Suppose several of their answers are copies or small rewrites from the same answer family. Those remain separate interactions, but their content supplies less variety than 20 unrelated situations. Related content can also land on both sides of a training and evaluation split, allowing a model to be tested on

something closely related to what it already saw. Preserve both interaction identity and content-family relationships. Scikit-learn's version 1.7 documentation describes evaluation splits that account for related groups, rather than assuming every row is independent. The appropriate group depends on the claim: it might be a customer, incident or source answer family.

A group rule does not repair missing language coverage, and a random split does not guarantee an independent test. State the intended new situation and check the membership that supports it. Here is the checkpoint. Why should evaluation include cases that the product's easiest path did not select?

Think about the unanswered, incomplete and unusual requests outside our feedback collection. Real users can present incomplete, multilingual, unusual or difficult inputs. Evaluating only the accepted easy cases leaves those operating conditions untested and can understate the service's failures. The direction and size of any difference need evidence. Identify the missing cases and design a

relevant evaluation before claiming whole-service performance. For practice, examine another interaction-based feedback collection and a proposed safety stress test. State the target population, the observed interactions, the missing conditions, and a test that would resolve a named uncertainty. Our 16 positive ratings remain observations about 16 rated interactions.

They cannot establish the experiences in the other 80 unrated interactions or a customer-level satisfaction rate. Before collecting more examples, ask which uncertainty the information will address. The next lesson examines how the target attached to each example is defined and checked.

Main Point

Follow the collection path before extending a result to a population. More rows cannot automatically repair systematic exclusions or repeated evidence.

Key Points

1. What does the 80% describe?

The fictional service has 100 distinct interaction IDs in one stated period. Each interaction has at most one eligible rating. Exactly 20 distinct interactions are rated, and 16 of those ratings are positive. Positive share among rated interactions is 16/20 = 80%; rating coverage is 20/100 = 20%. The other 80 interactions are unrated. Customers can have several interactions; no customer count or customer-level satisfaction rate follows.

Statistics Canada's volunteer-sampling discussion explains why self-selection complicates population inference. Its non-sampling-error account distinguishes systematic errors that can persist with larger samples. These survey principles motivate investigating the service collection; they provide no measured bias magnitude for this case. [SC-SAMPLE; SC-ERROR]

2. Examine the route and missing conditions

Map invitation, ability to respond, choice to respond, filters and retained example. Check abandoned requests and unsupported conditions. An extract of daytime completed requests leaves other operating conditions unobserved. Relevant representation follows the task and consequences rather than a blanket rule of equal group counts.

A deliberately enriched unauthorized-request test asks whether a specific failure occurs under those conditions. Its class fraction need not match production. Avoid presenting its unweighted overall result as an operating-frequency estimate without a justified design.

3. Fix the named inference problem

Weighting needs credible inclusion information and assumptions. An absent condition supplies no response observations for arithmetic to recover. Obtain relevant data or bound the claim. Distinct interactions can reuse answers from the same content family. This content dependence is separate from duplicate interaction IDs or repeated ratings for one interaction. State and preserve both identities when designing an independent evaluation.

Scikit-learn 1.7.2's cross-validation documentation discusses grouped data and how train/test design follows dependence. This software method does not establish that a particular service split is valid. [SK-GROUP]

Keep a collection record with the target population, period, invitation and filter rules, counts, missing conditions, duplicate families, intended inference and limitations. Test the weakest relevant path while keeping results attributable to the actual population. The worksheet offers distinct cases and a separate key.

4. A dated example

A NIST study released on December 19, 2019 tested face-recognition algorithms across demographic groups. Most tested algorithms showed differences, with results depending on the algorithm, application and input data. The researchers did not determine what caused those differences. This is a reason to examine performance for relevant groups and tasks, rather than infer it from one overall result. It does not prove that a particular training imbalance caused the results, or tell us how large a difference our returns service would show.

5. Bringing the lesson together

The opening 80% describes rated interactions. You can now trace selection, name unobserved conditions and choose a test that addresses a specific inference gap while preserving the population and unit.

Learning Checks

Attempt each answer before expanding the reasoning.

M13-L08-Q01

Why should evaluation include cases that the product's easiest path did not select? Think about the unanswered, incomplete and unusual requests outside our feedback collection.

Show reasoning

Real users can present incomplete, multilingual, unusual or difficult inputs. Evaluating only the accepted easy cases leaves those operating conditions untested and can understate the service's failures. The direction and size of any difference need evidence. Identify the missing cases and design a relevant evaluation before claiming whole-service performance.

Sources

Learner Materials

Download Lesson 8 Learner Materials

Use the supplied fictional cases and templates for practice.

Practice

Write your answer, compare it with the model answer and decide what to revisit. These written checkpoints are self-assessed.

Here is the checkpoint. Why should evaluation include cases that the product's easiest path did not select? Think about the unanswered, incomplete and unusual requests outside our feedback collection.

Show The Model Answer

Real users can present incomplete, multilingual, unusual or difficult inputs. Evaluating only the accepted easy cases leaves those operating conditions untested and can understate the service's failures. The direction and size of any difference need evidence. Identify the missing cases and design a relevant evaluation before claiming whole-service performance.

Compare your reasoning with the model answer. These written checks are self-assessed.

Open Practice And Save Your Work