Stay organized with collections
Save and categorize content based on your preferences.
Creates an empty k-NN classifier.
The k-nearest neighbor algorithm (k-NN) is a method for classifying objects by a majority vote of its neighbors, with the object being assigned to the class most common amongst its k nearest neighbors (k is a positive integer, typically small, typically odd).
Usage
Returns
ee.Classifier.smileKNN(k, searchMethod, metric)
Classifier
Argument
Type
Details
k
Integer, default: 1
The number of neighbors for classification.
searchMethod
String, default: "AUTO"
Search method. The following are valid [AUTO, LINEAR_SEARCH, KD_TREE, COVER_TREE].
AUTO will choose between KD_TREE and COVER_TREE depending on the dimension count. Results may vary between the different search methods for distance ties and probability values. Since performance and results may vary consult with SMILE's documentation and other literature.
metric
String, default: "EUCLIDEAN"
The distance metric to use. NOTE: KD_TREE (and AUTO for low dimensions) will not use the metric selected. Options are:
'EUCLIDEAN' - Euclidean distance.
'MAHALANOBIS' - Mahalanobis distance.
'MANHATTAN' - Manhattan distance.
'BRAYCURTIS' - Bray-Curtis distance.
[[["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 2024-07-13 UTC."],[[["Creates a k-Nearest Neighbors (k-NN) classifier using the SMILE machine learning library within Google Earth Engine."],["The classifier is trained using labeled data and can be applied to classify images based on the proximity of pixel values to known classes."],["Users can customize the number of neighbors (k), search method, and distance metric for the k-NN algorithm."],["Includes JavaScript and Python examples demonstrating classifier training and image classification using Landsat 8 data."]]],[]]