--- title: MobilePriceClassification emoji: 📱 colorFrom: blue colorTo: purple sdk: docker app_port: 8501 tags: - streamlit pinned: false short_description: Classifies smartphone price ranges using a KNN model. license: mit --- # 📱 Smartphone Price Range Classification This project is a **machine learning web application** that predicts the **price range of a smartphone** based on its technical specifications such as RAM, battery power, screen resolution, and connectivity features. Instead of predicting the exact price, the model classifies smartphones into one of four predefined categories. --- ## 🎯 Price Categories - **0** – Low Cost - **1** – Medium Cost - **2** – High Cost - **3** – Very High Cost --- ## 🤖 Model Overview - **Algorithm:** K-Nearest Neighbors (KNN) - **Preprocessing:** StandardScaler - **Task Type:** Multi-class classification - **Dataset Size:** 2,000 smartphones with 20 technical features The KNN model achieved **high accuracy and balanced performance** across all price categories. --- ## 🚀 How the App Works 1. The user enters smartphone specifications. 2. The input data is scaled using the same scaler as during training. 3. The trained KNN model predicts the price range. 4. The predicted class and label are displayed instantly. --- ## 📂 Project Files - `app.py` – Streamlit application - `knn_model.pkl` – Trained KNN model - `knn_scaler.pkl` – Fitted StandardScaler - `knn_features.pkl` – Feature names and correct input order - `requirements.txt` – Python dependencies --- ## ▶️ Run Locally ```bash pip install -r requirements.txt streamlit run app.py