JRJoshua RandallSystems. Software. Possibility.

AI DEVELOPMENT / DEDICATED BUILD

Machine Learning

Fit predictive functions from examples while keeping data separation, baselines, uncertainty, and generalization testing explicit.

What it is

Fit predictive functions from examples while keeping data separation, baselines, uncertainty, and generalization testing explicit.

This page separates the concept, implementation path, interactive experiment, evaluation criteria, failure modes, and sources so the topic can be studied without relying on a summary tile.

Core concepts

Architecture / workflow

  1. Define the prediction target and success metric.
  2. Split data before tuning and prevent leakage across partitions.
  3. Train a simple baseline first.
  4. Fit candidate models and tune only on training/validation data.
  5. Evaluate once on held-out data, then monitor drift and calibration after deployment.

Technical foundations

Evaluation checklist

Failure modes and limits

Practical build path

  1. Train a linear or tree baseline on a small labeled dataset.
  2. Add a held-out split and confusion-matrix analysis.
  3. Compare calibration and error slices across two model families.
  4. Add drift monitoring and retraining criteria only after the baseline is reproducible.

Primary / authoritative references

Search the Learn library for related lessons →

AUTHORED STUDY COMPANION / 3.2

Fit a classifier without leaking the test set

Prerequisites. Vectors, conditional probability, gradients, and the distinction between fitting and evaluation.

A binary logistic model assigns p(y=1|x)=sigmoid(wᵀx+b). Cross-entropy penalizes confident wrong predictions; its gradient averages x(p−y). Starting with zero weights predicts 1/2 for every example. A useful first check is whether training loss falls after a modest update, not whether the model looks sophisticated.

The companion generates 180 fictional two-feature observations with seed 7 and splits them into 100 training, 40 validation and 40 test examples before fitting anything. The scaler learns its mean and standard deviation from training data only. Even unsupervised preprocessing can leak information if it sees held-out observations. The test split is inspected after the training choices in this fixed demonstration; repeated tuning against it would invalidate its role.

Confusion-matrix rows are true classes and columns are predicted classes. Compare the model with the training-majority baseline. Accuracy on 40 synthetic test cases is evidence about this fixture, not a production estimate. To extend the experiment, create a separate evaluation cohort with a changed boundary and inspect which errors increase.

Fit a classifier without leaking the test set — model structure
ElementModelInterpretation
Training100 rows; fit scaler and weightsEstimate parameters
Validation40 rowsCompare choices before freezing them
Test40 untouched rowsEvaluate the frozen procedure

Predict, run, compare

At zero weights, p=0.5 and loss=−log(0.5)≈0.6931. After 300 steps with learning rate 0.2, the notebook must show lower training loss. The confusion matrix must contain exactly 40 held-out examples.

Download executable notebooks and source Inspect source ↗

Open classifier.ipynb in the package. Run cells in order, compare with the reference, then change the stated input. Restart the kernel to reset.

Computed reference result — local CPU fixture
{
  "initial_loss": 0.6931471805599453,
  "final_loss": 0.1769847638834477,
  "weights": [
    3.3242225141344948,
    2.1729795799310923,
    -0.5192227268814227
  ],
  "validation": {
    "accuracy": 0.9,
    "confusion": [
      [
        19,
        4
      ],
      [
        0,
        17
      ]
    ]
  },
  "test": {
    "accuracy": 0.875,
    "confusion": [
      [
        19,
        4
      ],
      [
        1,
        16
      ]
    ]
  },
  "test_majority_baseline": 0.575,
  "seed": 7,
  "split": [
    100,
    40,
    40
  ]
}

This is the recorded result of the included code under the package environment. It is not a live service or device measurement.

Extend the experiment

Change the data-generating coefficient or noise level in a copied function. Freeze the trained model, then measure the resulting error slice without refitting the scaler on the new cohort.

Check your reasoning: Where should the scaler learn its mean?
  1. All 180 rows — That lets held-out distribution information enter fitting.
  2. Training rows only — Correct. The fitted preprocessing is part of the training procedure.
  3. Test rows only — That directly conditions preprocessing on evaluation data.

This is an explained self-check, not a certification of mastery.

Claim-specific sources

Reviewed 2026-10-02: this worked example and its explicit assumptions. Source links and notebook results do not establish production or hardware validation.

Explore the portfolio