Challenge

Supervised Learning - Classification Week 8 Challenge

1. Apply knn to the “Surface defects in stainless steel plates” and identify the differences

Week 8 challange.ipynb

2. What are the pros and cons of knn

K-Nearest Neighbors (KNN) is a type of machine learning algorithm used for classification or regression tasks. Here are some pros and cons of using KNN:

Pros:

1. Simple to implement: KNN is a simple algorithm that is easy to implement and understand, making it a good starting point for beginners in machine learning.

2. No assumptions about the data: KNN does not make any assumptions about the underlying data distribution, which means it can be used effectively with any type of data.

3. Non-parametric: KNN is a non-parametric algorithm, which means it does not require any assumptions about the data being normally distributed or having a linear relationship between variables.

4. Can handle multi-class classification: KNN can be used for multi-class classification problems by simply selecting the mode of the K nearest neighbors.

Cons:

1. Computationally expensive: KNN can be computationally expensive, especially when working with large datasets or high-dimensional data. This is because KNN needs to compute the distances between each observation in the dataset, which can be time-consuming.

2. Sensitive to the choice of K: The performance of KNN can be sensitive to the choice of K, the number of nearest neighbors used for classification or regression. Selecting the right value of K requires careful tuning, which can be challenging.

3. Not suitable for imbalanced datasets: KNN does not work well with imbalanced datasets, where one class is much more prevalent than others. In these situations, KNN will tend to predict the majority class, resulting in poor performance on minority classes.

4. Not effective with high-dimensional data: KNN can perform poorly with high-dimensional data because the distance between any two points in high-dimensional space tends to be similar, making it difficult to identify the nearest neighbors accurately. This is known as the "curse of dimensionality".

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.