AI Wiki中文/EN

Machine learning: define what changes and how improvement is measured

机器学习的问题框架

Separate task, experience, model, fitting and prediction with an exact clock-correction experiment.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

The program stays the same; the fitted answer changes

A fictional clock reports a tick count that differs from a reference clock. Three paired readings are (0,1), (2,4) and (4,7). The differences are 1, 2 and 3 ticks. A simple learner estimates a common correction of 2 ticks, then adds it to future readings.

The programmer chose what could be learned: one constant correction. The data determined its value. A different training set could produce a different correction without changing the program. Once fitted, the correction can be used many times without learning anything further.

That separation is central to machine learning. Mitchell frames a learning problem around a task, an experience source and a way to judge performance. For the clock, those choices are concrete:

ChoiceClock example
TaskPredict the reference reading from the clock reading
ExperiencePaired readings available for fitting
Performance measureMean squared error on separate readings

A claim that a system “learned” is incomplete until those choices are stated. Improvement on the data used for fitting and improvement on future cases are different claims. Mitchell, introductory slides 11–13.

The task, model and learning procedure have different jobs

The model family says which input-output relationships are allowed. The learning procedure uses experience to choose within that family. A fitted model is the resulting choice. Inference uses that choice on an input. Neural networks are one possible family; a learned scalar, decision tree or collection of stored neighbors can also support machine learning.

For the clock, the model family is hb(x)=x+bh_b(x)=x+b. The input xx is the reported reading, the parameter bb is a correction, and hb(x)h_b(x) predicts the reference reading. Training selects bb to reduce average squared error on n>0n>0 paired examples:

hb(x)=x+b,R^(b)=1n∑i=1n(xi+b−yi)2,b^=1n∑i=1n(yi−xi).h_b(x)=x+b,\qquad\widehat R(b)=\frac1n\sum_{i=1}^n(x_i+b-y_i)^2,\qquad\widehat b=\frac1n\sum_{i=1}^n(y_i-x_i).

No neural network or iterative optimizer is needed. This is the constant-correction special case of linear regression, with slope fixed at one. A useful identity explains why averaging the differences minimizes training error:

R^(b)=R^(b^)+(b−b^)2.\widehat R(b)=\widehat R(\widehat b)+(b-\widehat b)^2.

Write each difference as its average plus a deviation. The deviations sum to zero, so the cross terms cancel when the squares are expanded. The remaining extra square is nonnegative. This proves a training-objective claim; there is no corresponding guarantee for an arbitrary future dataset.

The programmer still chooses the measurements, model family, loss and evaluation procedure. The data do not make those decisions disappear. An offset model cannot correct a clock that runs progressively faster, and squared error makes large discrepancies count more than small ones. Choosing a richer model or a different loss changes the learning problem.

Learning regimes describe different kinds of feedback:

Regime or purposeWhat provides the learning signal?A concrete question
Supervised predictionInputs paired with target values or classesWhich reference reading matches this clock reading?
Unsupervised structurePatterns or relations within the supplied dataWhich recordings group together under a chosen similarity?
Reinforcement learningOutcomes and rewards from actions in an environmentWhich action sequence improves cumulative reward?
Generative modellingA training objective for producing structured outputsWhich continuations or images fit the learned distribution?

The last row describes an output purpose, so these labels are not disjoint boxes. Likewise, a cluster number is not automatically a meaningful class label, and a reward is not necessarily an immediate correct-action answer. Google’s introductory course discusses these regimes and allows systems to occupy more than one category. Official introduction.

Fit once, predict separately, evaluate against a baseline

The complete program below uses integer ticks and exact fractions so the arithmetic is inspectable. fit returns one immutable rational number. predict receives that number and does not update it. mse evaluates supplied pairs without refitting. A baseline offset of zero predicts that the clock already agrees with the reference.

Training and evaluation need nonempty list/tuple collections of two-integer rows. Boolean values and floating-point inputs are rejected by this teaching interface. Predictions allow an empty list and return an empty tuple. The offset can be an integer or Fraction. Input rows are copied; the functions do not modify their caller’s data.

# Python 3.10+; integer clock ticks and exact rational arithmetic.
from fractions import Fraction


def pairs(data):
    if type(data) not in (list, tuple) or not data:
        raise ValueError('provide a nonempty list or tuple of reading/reference pairs')
    result = []
    for row in data:
        if type(row) not in (list, tuple) or len(row) != 2:
            raise ValueError('each row must contain two integers')
        if any(type(value) is not int for value in row):
            raise ValueError('this teaching model accepts integer ticks')
        result.append(tuple(row))
    return tuple(result)


def parameter(offset):
    if type(offset) not in (int, Fraction):
        raise ValueError('offset must be an integer or Fraction')
    return Fraction(offset)


def fit(data):
    rows = pairs(data)
    return Fraction(sum(reference-reading for reading, reference in rows), len(rows))


def predict(offset, readings):
    offset = parameter(offset)
    if type(readings) not in (list, tuple) or any(type(x) is not int for x in readings):
        raise ValueError('readings must be a list or tuple of integer ticks')
    return tuple(x+offset for x in readings)


def mse(offset, data):
    offset = parameter(offset)
    rows = pairs(data)
    return sum(((x+offset-y)**2 for x, y in rows), Fraction(0))/len(rows)


if __name__ == '__main__':
    train = ((0, 1), (2, 4), (4, 7))
    held_out = ((1, 2), (3, 6))
    shifted = ((1, 7), (3, 9))
    model = fit(train)
    print('fitted offset:', model)
    print('training MSE:', mse(model, train))
    print('held-out MSE, baseline/model:', mse(0, held_out), mse(model, held_out))
    print('new predictions:', tuple(str(x) for x in predict(model, (10, 20))))
    print('shifted MSE:', mse(model, shifted))
    print('old offset after prediction:', model)
    replacement = fit(shifted)
    print('explicit refit, old/new:', model, replacement)
    print('refit MSE on reused data:', mse(replacement, shifted))

Its output is:

fitted offset: 2
training MSE: 2/3
held-out MSE, baseline/model: 5 1
new predictions: ('12', '22')
shifted MSE: 16
old offset after prediction: 2
explicit refit, old/new: 2 6
refit MSE on reused data: 0

On the two separate readings, the learned correction has MSE 1 while the uncorrected baseline has MSE 5. The result is useful evidence about these specified examples. The data were constructed for teaching; two held-out examples do not establish how an actual clock will behave.

Next the relationship shifts: the reference exceeds each reading by 6 ticks. Keeping the old correction gives MSE 16. Merely calling predict leaves the correction at 2. Calling fit again returns a new correction of 6; it does not change the old value. The final zero error is measured on the same shifted data used for refitting, so it is not a fresh test result.

With arithmetic operations counted at unit cost, fitting or scoring nn rows takes O(n) work and O(n) temporary row storage. Predicting kk readings takes O(k+1) work and output storage. Exact fractions avoid rounding here, but very large integers require additional bit-level work; the bounds do not treat arbitrary-precision arithmetic as physically free.

More experience can also repeat the wrong evidence

Repeating the same training rows preserves their average correction. It increases the row count without supplying independent information. Systematically wrong reference values can teach a systematically wrong correction. Neither issue is repaired simply by selecting a larger model.

A workflow needs a baseline, a held-out evaluation strategy and a reason that the evaluation resembles intended use. It should also keep track of which data produced which model. In this example, learning a new offset is an explicit operation. Some systems update online, but that requires a defined update rule and evidence policy; a prediction request alone does not imply continued learning.

Machine learning is one part of AI. Search, logic and planning can solve problems with hand-specified rules and no fitted model, and a learning system can contain such components. Conversely, arithmetic or automation is not automatically learning: adding a correction that a programmer hard-coded is a fixed rule. The distinction is how the rule or its parameters were obtained and how improvement is checked.

State exactly what the evidence supports

Exercise 1: which part was learned?

Answer: The value 2 was learned from the three paired readings. The family x+b, the use of average squared error and the decision to compare with an uncorrected baseline were specified by the programmer. A new input does not choose a new family or retrain the correction.

Exercise 2: duplicate every training row ten times

Answer: The correction remains 2 and the training MSE remains 2/3. Both the sum of differences and the sample count grow by the same factor. Those repeated rows are not thirty independent measurements.

Exercise 3: change the task to predicting whether the clock is faulty

Answer: That is now a classification task and needs a definition of “faulty,” suitable labels and an evaluation measure. A small average tick error does not itself define that label. One should not reuse the regression score as if it directly answered the new task.

Exercise 4: what does the refitted zero error prove?

Answer: Only that offset 6 fits the two shifted pairs perfectly under this loss. It does not establish zero future error. Preserve a fresh evaluation set or a stated prospective evaluation procedure before making that stronger claim.

Use this framework to choose the next chapter

Mitchell’s original introductory slides separate the learning problem, representation and training experience; the author’s book page identifies the 1997 textbook. Google’s introductory course supplies a complementary view of learning regimes and outputs. The historical slides’ application statistics are not treated as current evidence here.

Continue with supervised learning, train/validation/test splits, k-means and Q-learning. The clock data, implementation and exercises are original. They demonstrate what changes during fitting and what remains fixed during prediction; they do not benchmark a deployed learning system.

Make a prediction, then check

After predict returns estimates for new readings, the correction remains 2. What does this show?

Choose one answer

Learning objectives

  • Define a learning problem by task, experience and performance; distinguish model family, learning procedure, fitted parameter and prediction.
  • Compute the clock correction and baseline/held-out errors, explaining why prediction does not imply continued training.
  • Explain how reused data, biased references and distribution changes limit conclusions, and distinguish common learning regimes.

Prerequisites & connections

This article can be used as an entry point.

Explore related knowledge →

References

  1. Machine Learning — Chapter 1 introductory slides
    Tom M. Mitchell · 1997
  2. Introduction to Machine Learning — What is Machine Learning?
    Google for Developers

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-05 · Codex technical check: primary-source locations, original runnable models, independent mathematical and computational references, bilingual review and second-agent cross-checks; not independent human peer review.

  • Five author tests passed. For 27 residual triples, independent quadratic coefficients verify stationarity; 81 candidates verify the full loss and square-difference identity. Also checked all eight output lines, explicit refitting, duplication/translation/unit scaling and 200-digit integers.
  • Input checks cover empty training/evaluation, Boolean/float/bad containers and invalid offsets; empty prediction is valid and preserves the parameter. Preliminary review corrected prediction cost to O(k+1) and normalized English spacing around numbers.
  • Complete bilingual articles share code/output, two display equations, six anchors and four answered exercises; actual HTML passes with the repository display-math plugin and strict KaTeX. Original integer-clock data are instructional, with no real generalization benchmark or upstream program execution claimed; AI self-check remains written pending independent review.
  • Read complete bilingual articles, code, tests and final metadata. Task, measurements, model family, fitted offset, training rule, prediction and evaluation are separated accurately. The synthetic held-out comparison and reused-data refit error are not promoted to real-world performance evidence. Five author tests passed.
  • The independent reference recovers each quadratic objective by exact interpolation from its values at offsets -1, 0 and 1, then solves the reconstructed stationary point, rather than directly averaging differences. Eight datasets including negative, repeated, rational-optimum and very large integer cases pass; 56 MSE probes and 32 duplication, translation and order transformations agree. Three state checks confirm explicit refitting preserves the old scalar and predictions, including empty input, never call fit when it is replaced with a failing stub.
  • Reviewed the square-completion identity separately as a general training-optimality argument, with no arbitrary-future-data guarantee. The author fixed prediction cost from O(k) to O(k+1) for valid empty input and normalized English number spacing in prose and source metadata. Retained O(n) validation copies and arbitrary-precision bit-cost qualifications are accurate.
  • Final five hashes match. Strict MDX/KaTeX with actual React HTML passed: two identical displays, six stable anchors and four answered details in each locale; full code and eight output lines correspond. No author or repository file edited. Review excludes browser/full-site checks and full-book or independent slide inspection.
  • Promoted the full prose, equations, code and exercises. Tests read formal MDX only; removed temporary fallbacks/draft skips and updated review assertion to checked. Algorithm and independent references are unchanged; final record binds both locale hashes.

Source locations checked:

  • Machine Learning — Chapter 1 introductory slides · Actually read official book homepage https://www.cs.cmu.edu/~tom/mlbook.html and its slides index. The linked full 60 MB book failed the web fetch size limit. Read original 21-page chapter 1 PDF through web text: printed 11–13 lines 234–255 for T/P/E, target/representation/algorithm decisions and representativeness; printed 16–19 lines 282–312 for representation, training targets and updates. Used footer 1997, not search-engine crawl dates. No visual PDF inspection or full-book reading claimed; garbled minus signs in checkers formulas are not used.
  • Introduction to Machine Learning — What is Machine Learning? · Actually read official page through web text: lines 51–86 for model/training and explicitly one-or-more categories; lines 108–145 for classification versus numerical prediction, unsupervised clusters and rewards; lines 148–159 for generative inputs/outputs. The original weather, health and product examples, figures, generated sample text and code are not reused. No release date inferred from the changing page.
  • Machine Learning — Chapter 1 introductory slides · Independently read official author book homepage https://www.cs.cmu.edu/~tom/mlbook.html, identifying Machine Learning, McGraw Hill, 1997 and algorithms improving through experience. Direct chapter-1 slide PDF opens over HTTPS and HTTP were rejected by the web tool; a normal curl attempt failed DNS resolution. I therefore do not claim an independent read of the 21 slides or full book. Read the author’s SOURCE_NOTES and final metadata distinguishing the actual slide read from failed whole-book access; task/experience/performance and representation scope were checked conceptually. The source access limitation is retained explicitly.
  • Introduction to Machine Learning — What is Machine Learning? · Independently opened official HTML through web. Read lines 51–89 for training/model/prediction, one-or-more learning categories and supervised regression; lines 96–142 for classification, clustering and the lack of intrinsic cluster semantics; lines 143–159 for rewards and generative outputs; lines 186–190 for training stages. Last updated 2026-01-27 UTC at line 213, not a new publication date. Did not adopt the source’s sample generated text, product examples, figures, code or performance claims.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.