liveBook · Manning

Synthetic data

As explained in Learn AI-Assisted Python Programming, Second Edition

Synthetic data is data generated artificially rather than collected directly from the target process, often to approximate its properties or meet specified requirements.

Synthetic data is deliberately generated data that resembles real data while making expected answers and unusual cases controllable. It supports testing when real examples are difficult to find or expensive to analyze. section 6.6 section 6.6.1

Effective synthetic test data should:

  • Include edge cases that may be absent from the real dataset. section 6.6
  • Stay close enough to real data that the tests represent likely production inputs. section 6.6.1
  • Keep test cases together when a single file makes expected results easier to manage. section 6.6.1

A controlled player-statistics test file

A CSV can repeat Aaron Rodgers across several rows, include a running back with passing yards, and add zero and negative totals. The expected totals are therefore known: Rodgers has 800 yards, Kerryon Johnson 5, Leo Porter 0, Jared Goff 190, and Dan Zingaro −10. section 6.6.1

Table 6.3 Our file to test the NFL passing yards function
game_id
player_id
position
player
team
pass_cmp
pass_att
pass_yds
pass_td
201909050chi
RodgAa00
QB
Aaron Rodgers
GNB
20
30
200
1
201909080crd
JohnKe06
RB
Kerryon Johnson
DET
1
1
5
0
201909080crd
PortLe00
QB
Leo Porter
UCSD
0
1
0
0
201909080car
GoffJa00
QB
Jared Goff
LAR
20
25
200
1
201909050chi
RodgAa00
QB
Aaron Rodgers
GNB
10
15
150
1
201909050chi
RodgAa00
QB
Aaron Rodgers
GNB
25
35
300
1
201909080car
GoffJa00
QB
Jared Goff
LAR
1
1
–10
0
201909080crd
ZingDa00
QB
Dan Zingaro
UT
1
1
–10
0
201909050chi
RodgAa00
QB
Aaron Rodgers
GNB
15
25
150
0

Inspect the complete artificial CSV, including repeated records, non-quarterbacks, zero values, negative values, and single-entry players. section 6.6.1

How Learn AI-Assisted Python Programming, Second Edition covers it

How deep it goes
Explains dataset design and expected outputs, but stops short of describing generation algorithms or statistical fidelity.
Examples
Uses an artificial NFL statistics file containing repeated players, non-quarterbacks, zero values, and negative passing yards.
What it assumes
Assumes a function or query to test and some understanding of the real dataset’s fields and expected behavior.
What you can do after
Diagnose/debug functions by testing known outputs against realistic records and intentionally included edge cases.
How it connects
Connects synthetic data with software testing, edge cases, test cases, CSV files, and real datasets.

Also explained in

Compare how 15 books explain synthetic data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn AI-Assisted Python Programming, Second Edition. The section links point to the parts of the book it draws on.