MockDataLab
Data & MLNature / JMLR-style referenceseed 42

Custom formula dataset generator

Type a formula, name each input, pick a uniform or normal draw, and add Gaussian noise, uniform noise, or outlier spikes. The boxes start at y = 3x² + sin(x) only so the page is not empty. Replace that expression. Seeded files stay marked synthetic.

Initial expression, editable

y = 3*x^2 + sin(x)

Static snapshotCSV (seed 42) ↓
Interactive dataset studio loads as it enters view…

What this page generates

This is the free-form bench, not a named specimen. The parser reads numbers, names, parentheses, + − * / and ^, and a short list of functions: sin, cos, tan, exp, log, sqrt, abs, min, max, and a few more. pi, e, and tau are constants. An unknown name becomes an input and gets a distribution card. The string is not passed to eval. A broken parenthesis shows an error and keeps the last successful chart.

Each input is drawn before the formula runs, in the order the names first appear. Uniform draws use one random number. Normal draws use two, through the Box–Muller transform, unless the standard deviation is 0, in which case the mean is written and no random number is spent. Noise is applied to the output only. Gaussian noise uses another normal draw. Uniform noise uses one draw on [−level, level]. Outliers, if the fraction is positive, spend a draw to decide and another draw for the sign.

The Python you copy follows that same spending order, with a small mulberry32 implementation so NumPy’s Generator is not required to match. The opening comment repeats the synthetic-data banner and the seed. The initial parabola is only a default. If you wanted the essay about that parabola, use the quadratic template. If you change the formula here, you are making a different dataset, and the header will record the new expression.

Generating rule

Initial expression, editable

y = 3*x^2 + sin(x)

Check values

Worked numbers

The editor opens on seed 42 only so the fields are not blank. Until you replace the expression, the first row matches the quadratic specimen. After you replace it, the header records the new expression and the old parabola article no longer describes the file.

Parameters and defaults

Parameters, defaults, and what they change
ParameterDefaultRangeEffect
formula3*x^2 + sin(x)parser grammar aboveSets the clean output. New names become inputs.
output nameyidentifierColumn name. A leading “name =” in the formula overrides it.
noise kindGaussian, std 1.1none, Gaussian, uniformHow measurement error is added.
outliers4 percent, size 6fraction 0–1, size ≥ 0Optional spikes on top of the base noise.
seed42unsigned 32-bitRepeats every draw the formula consumes.

Python for this seed

Full script with mulberry32() & box_muller() available via Copy Python above

reproduce_seed_42.pyseed 42
# SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com)
# This file is synthetic and must not be presented as real measurements, clinical data, or results from a physical instrument.
# generator: function-relation
# seed: 42
# formula: y = 3*x^2 + sin(x)
# samples: 180

# mulberry32() and box_muller() are included when you copy the full script.


SEED = 42
N = 180
rng = mulberry32(SEED)

x = np.empty(N, dtype=np.float64)
y_clean = np.empty(N, dtype=np.float64)
y = np.empty(N, dtype=np.float64)

for i in range(N):
        x[i] = (-2.0) + ((2.0) - (-2.0)) * rng()
        y_clean[i] = ((3.0 * (x[i] ** 2.0)) + math.sin(x[i]))
        noise = 0.0
        noise += (1.1) * box_muller(rng)
        if rng() < 0.04:
            noise += (-1.0 if rng() < 0.5 else 1.0) * (6.0)
        y[i] = y_clean[i] + noise

columns = ["x","y_clean","y"]
data = np.column_stack([x, y_clean, y])

Exercises

  • EXERCISE 01Turn a homework equation into a CSV without writing a sampling script.
  • EXERCISE 02Check that a new column name appears both in the table and in the Python.
  • EXERCISE 03Produce a one-off fixture whose header lists the exact expression.

Questions

Why does my formula fail?

Multiplication needs a star. 3x is not 3*x. Unknown functions are rejected. log is natural log.

Does this page duplicate the quadratic template?

Only until you edit it. The quadratic page is an article about that one specimen. This page is the editor.

Where does the synthetic banner go?

On the CSV comment lines, in the JSON metadata, and at the top of the Python script: SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com).

Can I upload a real series to mix in?

No. There is no upload. Paste a formula, not patient values or a lab log.

Related

SYNTHETIC DATA - generated by MockDataLab (mockdatalab.com). Do not present the download as a real measurement.