Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
Stay organized with collections
Save and categorize content based on your preferences.
This page provides information regarding changes to the Earth Engine API
and steps necessary to transitions to new API features.
trainClassifier
On 8/25/2016, the Image.trainClassifier() and
FeatureCollection.trainClassifier()
algorithms were deprecated and replaced with Classifier.train(). The new API
separates the steps of collecting training data and building the classifier, in
order to allow easier access to the classifier parameters and to facilitate better
control over the training data (ie: splitting the training data for validation).
The following example illustrates converting from trainClassifier() to
Classifier.train():
(For more information, see the classification section.
Classifiers are now explicitly created using one of the constructors in the
ee.Classifier namespace.
Training points are extracted from images using sample(),
sampleRegions() or stratifiedSample()
The new classifier system doesn't directly support bootstrapping, however using
random sampling (via randomColumn())
on the training points, you can create multiple classifiers and perform bootstrapping manually.
The mode of the classifier (classification, regression or probability) is set using
classifier.setOutputMode()
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-05-26 UTC."],[[["On 8/25/2016, `Image.trainClassifier()` and `FeatureCollection.trainClassifier()` were replaced by `Classifier.train()`, which separates training data collection and classifier building for improved control."],["Creating classifiers now requires using constructors within the `ee.Classifier` namespace, and training points are extracted with methods like `sampleRegions()`."],["While bootstrapping isn't directly supported, it can be achieved manually with random sampling using `randomColumn()`."],["The classifier's mode (classification, regression, or probability) is determined by `classifier.setOutputMode()`."]]],["The Earth Engine API updated its classifier training process. `Image.trainClassifier()` and `FeatureCollection.trainClassifier()` were replaced by `Classifier.train()`. The new approach separates data collection via `sample()`, `sampleRegions()`, or `stratifiedSample()` from classifier building. Classifiers are now created using `ee.Classifier` constructors. The output mode (classification, regression, probability) is set via `classifier.setOutputMode()`. Bootstrapping requires manual implementation using random sampling.\n"]]