Synthetic data for ML testing
Make a CSV where the answer is known, so you can check whether a model finds it. Choose a rule, set the noise and any messy-data options, and download the data with an answer key. Everything runs in your browser; nothing is uploaded.
1. Choose the rule
2. Settings
You can use + - * / ^, brackets, pi and e, and the functions sin, cos, tan, exp, log, sqrt, abs, min, max and pow. Example: sin(x1) + x2^2 - max(x3, 0). For classification the class is 1 when the formula is above zero; to use another threshold, subtract it, for example x1 + x2 - 2.
The same seed and settings always give the same file. Inputs that matter are the first ones in the file; the rest are noise the model should learn to ignore.
3. Preview and download
Answer key
The rule used to make the target, so you can compare it with what a model finds.
How to use it with a model
Linear regression: a model should recover the weights in the answer key, within the noise you chose.
Logistic: the class 1 share and the weights should show up in the fitted model.
If-then rule: decision trees and random forests should learn the thresholds. Inputs that do not matter are the ones after x2.
Load the CSV in the scikit-learn playground to train and compare models on it.
Questions
Is the data real?
No. Every value is made from a random number generator with a rule on top, so no real person's data is used.
Why does the same seed give the same file?
The seed starts the random number generator. The same seed, settings and rule always make the same numbers, on any computer, so a result can be repeated.
What does the answer key tell me?
The weights, thresholds or class share that were used to make the target. A model should land close to these values. Noise and flipped labels make the match looser, by design.
Can I make fake names and addresses?
No. For that, use the Test Data Generator. This page is for models, where the answer is known.
How do I write a formula?
Use x1, x2 and so on for the inputs. The number is the column: x1 is the first input in the CSV, x2 the second. You can only use inputs up to the number you set under "Inputs (columns)". Combine them with +, -, *, /, ^ (power) and brackets, for example (x1 + x2) * 0.5 or x1^2 - x2. You can also use pi and e.
Which functions can I use?
sin, cos, tan, exp, log (natural log, only for values above 0), sqrt (only for values 0 or above), abs, min(a, b), max(a, b) and pow(a, b). Each function needs brackets around its inputs, for example max(x1, 0).
Why is there a formula in the answer key?
The key stores your formula exactly as you typed it, so a model's result can be compared with the rule that made the data.
What is the difference between the two formula options?
"Your formula (regression)" makes the target a number: the formula's value for each row, plus the noise you set. "Your formula (class 1 when above 0)" makes the class: 1 when the formula is above zero, otherwise 0. To use a different cut-off, subtract it inside the formula, for example x1 + x2 - 2 means class 1 when x1 + x2 is above 2.
What happens when the formula can't be worked out for a row?
Some rows give an answer the formula can't produce, such as dividing by zero, taking the log of a negative number, or a result too large to store. Those rows get a target of 0 instead, and the answer key counts them in badRowsSetToZero. If that count is high, change the formula so it stays in range for your inputs.
Why does my formula show an error?
The message points to the character where the problem starts. Common causes: a missing bracket, an input number above the number of inputs you set, a function name that is spelled wrong, or a function with the wrong number of inputs (for example max(x1) instead of max(x1, 0)). Formulas can be up to 1,024 characters.
Can I use a formula with missing values or label flips?
Yes. The target is always worked out from the full input values. Missing input values are only blanked in the CSV afterwards, so the target is not affected, and the answer key records how many cells were left empty. Label flips change the class after the formula is worked out, the same as with the built-in rules.