You are browsing as a guest. Sign up (or log in) to start making projects!

Fruit Classifier

  • 1 Devlogs
  • 1 Total hours

Fruit Classifier is an interactive machine learning app built with Python and Streamlit that uses the K-Nearest Neighbors (KNN) algorithm to classify a fruit as an Apple or Orange based on its weight and size. Users can enter their own values and see both the model’s prediction and a scatter plot showing where their fruit fits among the existing data.

Ship #1 Pending review

My Fruit Classifier Project


I recently built a Fruit Classifier using Python, Streamlit, and the K-Nearest Neighbours (KNN) machine learning algorithm.

The app predicts whether a fruit is an Apple or an Orange based on its weight and size. Users can enter their own values, and the model compares the new fruit with the closest examples in the dataset before predicting. This is a very simple project, and I was exploring KNN. I know there are many features I could add to predict the fruit, but I will stick with the basics for now and add more later. Additionally, this project learns only from a specific dataset. It gives you the output based on that dataset.

I also added a scatter plot so you can actually see how the Apples and Oranges are grouped and where the new fruit appears. This helped me understand KNN much better because I could see how the model was making its decision rather than just getting a prediction on the screen.

While building this project, I learned more about supervised machine learning, classification, working with numerical data, visualising data, and turning a Python program into an interactive Streamlit app.

I had a lot of fun building and testing this project, and I would really appreciate your support.

If you like my Fruit Classifier, please consider giving it a good rating. I am working towards, hopefully, earning a 3D printer, and your votes can help me get closer to that goal.

Thank you so much for checking out my project and supporting me!

  • 1 devlog
  • 1h
Try project → See source code →
Open comments for this post

47m 41s logged

Building My Fruit Classifier :apple-smug: 🍊

For this project, I wanted to understand how a machine learning model decides between two categories, so I built a Fruit Classifier using Python, Streamlit, and K-Nearest Neighbors (KNN).


The idea is simple: give the app a fruit’s weight and size, and it predicts whether the fruit is more likely to be an Apple or an Orange.


What made this project interesting was learning how KNN works. Instead of using a huge, complicated formula, the model looks at the fruits that are closest to the new fruit in the dataset and basically asks, “What are my nearest neighbours?” If most of them are apples, it predicts Apple. If most are oranges, it predicts Orange.


I also added a scatter plot so the result is not just a random prediction appearing on the screen. You can actually see the apples and oranges in the dataset and where the fruit you entered appears among them. This made KNN much easier for me to understand visually.


One of the fun parts was testing strange combinations of weight and size just to see what the model would predict. :smug1: Sometimes the result was obvious, and sometimes the fruit landed right between the two groups, which made the classification more interesting.


Now I have a machine that can settle one of life’s most important questions: Apple or Orange? 🍎 :tw_crossed_swords: 🍊

0
0
4

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…