MindMap Gallery k-Nearest Neighbor Algorithm Knowledge Framework Notes
Notes on the k-nearest neighbor algorithm knowledge framework. A picture will help you fully understand the relevant content. Mind mapping will help you improve efficiency. Come and give it a try~
Edited at 2022-12-07 21:53:17Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
k-Nearest Neighbor Algorithm Knowledge Framework Notes
Overview of k-nearest neighbor algorithm
advantage
High precision
Not sensitive to outliers
No data entry assumed
shortcoming
High computational complexity
High space complexity
Applicable data range
Numerical type
Nominal type
working principle
Each data in the sample set has a label
After entering new data without labels
Compare each feature of the new data with the corresponding features of the data in the sample set
The algorithm extracts the classification labels of the data with the most similar features in the sample set
Generally, the top k most similar data are selected
Select the category with the most occurrences among the k most similar data as the category of new data
process
Data collection
any method
Prepare data
The numerical value required for distance calculation, preferably in a structured data format
analyze data
any method
training algorithm
not applicable
Test algorithm
Calculate error rate
Use algorithms
Input sample data and structured output results
Run kNN to determine which category the input data belongs to
Perform subsequent processing on the calculated classifications
Preparation: Import data using Python
Parse data from text file
pseudocode
Calculate the distance between a point in a known category dataset and the current point
Sort by increasing distance
Select the nearest k point
Determine the frequency of occurrence of the category of these k points
Return the category with the highest frequency
Python code
Euclidean distance
How to test a classifier
Example: Using kNN to improve matching on a dating website
Preparing data: parsing data from text files
Get the number of file lines
Create a 0-filled NumPy matrix
Loop through each row and store into matrix
NumPy handles strings
Notice
NumPy arrays do not support Python’s own array types
Analyzing Data: Using Matplotlib to Create Scatter Plots
Distinguish between categories
Prepare the data: Normalized values
newValue = (oldValue - min) / (max - min)
Testing the algorithm: validating the classifier as a complete program
Ratio of training set and test set
Using algorithms: building a complete usable system
Example: Handwriting recognition system
Prepare the data: Convert images to test vectors
Test algorithm: Use kNN to recognize handwritten digits
Large time and space overhead
k decision tree optimization