← Kembali ke Akademi
At a workshop bench, a learner clips up a second strip of sensor readings while the instructor points to the shape of the first trace.
Pengetahuan AIInti24 Nov 2026· 3 mnt

Incremental Learning From Mini-Batches

Incremental learning lets a model update from small batches that fit in memory, reusing earlier parameters. Consistent features, declared class labels and careful evaluation keep each update meaningful, while drift still needs human attention.

incremental learningmini-batchesdata streams

Sumber

Ringkasan pelajaran lengkap

Incremental learning means updating a model from one small batch of examples at a time rather than loading an entire dataset into memory. The batch is called a mini-batch. Each update reuses the parameters the model already learned, so training can resume after saving and restoring the fitted estimator and its settings. A library function such as partial_fit is the usual handle for this. The first call often needs extra information, and later calls simply continue from where the model stopped.

Consider a hypothetical school that records quiz attempts as they happen. Each evening a batch of 500 attempts arrives, each described by 12 numeric features such as time on task and number of hints used. A linear classifier is updated with partial_fit on that batch. The next evening another 500 attempts arrive and the same parameters are adjusted again. Memory holds only one batch, yet the current parameters reflect a sequence of updates and may retain earlier patterns to different degrees. Interpretation matters here. The model is not retrained from scratch each evening, so its final state depends on the order and composition of the batches, not only on the total data.

Consistent feature mappings are essential. If one batch encodes a hint count in a column and a later batch places a different quantity in that column, the reused parameters become meaningless. The same applies to scaling. A standardiser fitted on the first batch and reused later keeps columns comparable, while refitting it on each batch can shift the meaning of every weight. For classification, a learner such as scikit-learn’s SGDClassifier requires the set of possible classes on its first incremental update. Pass all possible classes to the first partial_fit call, typically by collecting them beforehand. A stateless feature extractor may cope with unseen attributes, but the learner itself may not cope with unseen target classes.

Suppose the quiz changes midway through the term. Streaming simply delivers data in sequence. Adaptation to drift, where the relationship between features and outcomes changes over time, is a separate decision. An incremental model will keep updating, but nothing guarantees it tracks drift well, and a fixed learning rate may let old patterns dominate or let noise dominate. Evaluation on later observations is the honest test. Hold out batches that arrive after training and score the model on them, because accuracy on the batches used for updating overstates performance.

This process can be simulated with fictional examples on index cards. Give pairs a deck of 40 cards, each with two feature values and a label. Each pair updates a simple rule by hand after every five cards and writes the rule on a strip of paper. Then hand out ten fresh cards and ask pairs to predict before revealing labels. Ask them to compare their rule after the first batch with their rule after the last. Which batch changed the rule most, and why? Record predictions on a shared chart so the class can discuss ordering effects and whether the final rule still matches the newest cards.

Score the ten new cards after recording the predictions. Ask whether a pair that changed its rule on seeing the new labels could report that same score as an independent test. The next envelope of cards gives the class a way to find out.