{"id":22305322,"url":"https://github.com/steveee27/e-commerce-product-description-classification","last_synced_at":"2025-03-26T00:45:45.969Z","repository":{"id":262952462,"uuid":"888881588","full_name":"steveee27/E-Commerce-Product-Description-Classification","owner":"steveee27","description":"Classify e-commerce product descriptions into categories (Household, Books, Electronics, Clothing \u0026 Accessories) using SVM and Random Forest models with TF-IDF and Word2Vec representations. Includes data preprocessing, hyperparameter tuning, and model evaluation for performance comparison.","archived":false,"fork":false,"pushed_at":"2024-11-15T07:43:13.000Z","size":5293,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T21:32:37.063Z","etag":null,"topics":["e-commerce","machine-learning","nlp","product-classification","random-forest-classifier","svm","svm-classifier","text-classification","tf-idf","word2vec"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steveee27.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T07:27:12.000Z","updated_at":"2024-11-15T07:43:16.000Z","dependencies_parsed_at":"2024-11-15T08:37:07.983Z","dependency_job_id":null,"html_url":"https://github.com/steveee27/E-Commerce-Product-Description-Classification","commit_stats":null,"previous_names":["steveee27/e-commerce-product-description-classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveee27%2FE-Commerce-Product-Description-Classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveee27%2FE-Commerce-Product-Description-Classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveee27%2FE-Commerce-Product-Description-Classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveee27%2FE-Commerce-Product-Description-Classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steveee27","download_url":"https://codeload.github.com/steveee27/E-Commerce-Product-Description-Classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245568581,"owners_count":20636803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["e-commerce","machine-learning","nlp","product-classification","random-forest-classifier","svm","svm-classifier","text-classification","tf-idf","word2vec"],"created_at":"2024-12-03T19:10:57.331Z","updated_at":"2025-03-26T00:45:45.950Z","avatar_url":"https://github.com/steveee27.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E-commerce Product Classification\n\nThis project focuses on classifying product descriptions from an e-commerce website into four categories: Household, Books, Electronics, and Clothing \u0026 Accessories. The classification model uses two machine learning algorithms, SVM and Random Forest, and two text representation methods, TF-IDF and Word2Vec.\n\n## Table of Contents\n- [Project Overview](#project-overview)\n- [Project Workflow](#project-workflow)\n- [Results](#results)\n- [Conclusion](#conclusion)\n- [License](#license)\n\n## Project Overview\n\n- **Data Source**: Product descriptions from an e-commerce website with labels for four categories.\n- **Text Representation Techniques**: TF-IDF and Word2Vec.\n- **Machine Learning Algorithms**: Support Vector Machine (SVM) and Random Forest.\n- **Performance Metrics**: Accuracy, Precision, Recall, and F1 Score.\n\n## Project Workflow\n\n1. **Data Preprocessing**: \n   - Clean the data by removing special characters, converting text to lowercase, and performing lemmatization.\n   - Remove stopwords to focus on significant words.\n2. **Text Representation**:\n   - **TF-IDF**: Term Frequency-Inverse Document Frequency to represent text as numerical vectors.\n   - **Word2Vec (CBOW)**: Continuous Bag of Words to capture the semantic similarity between words.\n3. **Modeling and Hyperparameter Tuning**:\n   - **Algorithms**: Apply SVM and Random Forest with hyperparameter tuning for each text representation method.\n   - Tune at least two hyperparameters for each algorithm to improve performance.\n4. **Evaluation and Comparison**:\n   - Evaluate model performance on test data using Accuracy, Precision, Recall, and F1 Score.\n   - Compare results across different models and text representation techniques to determine the most effective approach.\n\n## Results\n\n| Text Representation   | Algorithm     | Hyperparameters                              | Accuracy | Precision | Recall | F1 Score |\n|-----------------------|---------------|----------------------------------------------|----------|-----------|--------|----------|\n| **TF-IDF (Default)**  | **SVM**       | c = 1.0, kernel = rbf, gamma = scale         | 0.9547   | 0.9553    | 0.9547 | 0.9547   |\n|                       | SVM (Tuning 1)| c = 0.5, kernel = linear, gamma = auto       | 0.9544   | 0.9546    | 0.9544 | 0.9543   |\n|                       | SVM (Tuning 2)| c = 1.5, kernel = poly, gamma = scale        | 0.8346   | 0.8783    | 0.8346 | 0.8357   |\n|                       | **Random Forest** | n_estimators = 100, max_depth = None, min_samples_split = 2 | 0.9345 | 0.9338 | 0.9345 | 0.9344 |\n|                       | Random Forest (Tuning 1) | n_estimators = 150, max_depth = 20, min_samples_split = 5 | 0.8140 | 0.8630 | 0.8140 | 0.8140 |\n|                       | Random Forest (Tuning 2) | n_estimators = 50, max_depth = 50, min_samples_split = 3 | 0.9218 | 0.9260 | 0.9218 | 0.9216 |\n| **TF-IDF (Tuned)** \u003cbr\u003e min_df = 5, max_df = 0.95 | **SVM** | c = 1.0, kernel = rbf, gamma = scale | **0.9551** | **0.9556** | **0.9551** | **0.9551** |\n|                       | Random Forest | n_estimators = 100, max_depth = None, min_samples_split = 2 | 0.9361 | 0.9376 | 0.9361 | 0.9360 |\n| **Word2Vec (CBOW)**   | **SVM**       | c = 1.0, kernel = rbf, gamma = scale         | 0.9290   | 0.9292    | 0.9290 | 0.9289   |\n|                       | SVM (Tuning 1)| c = 1.5, kernel = linear, gamma = scale      | 0.9298   | 0.9298    | 0.9298 | 0.9297   |\n|                       | SVM (Tuning 2)| c = 0.5, kernel = poly, gamma = auto         | 0.8544   | 0.8567    | 0.8544 | 0.8526   |\n|                       | **Random Forest** | n_estimators = 100, max_depth = None, min_samples_split = 2 | 0.9405 | 0.9406 | 0.9405 | 0.9405 |\n|                       | Random Forest (Tuning 1) | n_estimators = 75, max_depth = 45, min_samples_split = 4 | **0.9425** | **0.9426** | **0.9425** | **0.9424** |\n|                       | Random Forest (Tuning 2) | n_estimators = 200, max_depth = 25, min_samples_split = 5 | 0.9406 | 0.9406 | 0.9406 | 0.9406 |\n\n**Notes**:\n- Hyperparameter tuning was performed to optimize the models for higher accuracy and F1 scores.\n- The **SVM model with TF-IDF (Tuned)** and **Random Forest with Word2Vec (CBOW)** achieved the best performance overall.\n\n## Conclusion\n\nThe results clearly demonstrate that the combination of TF-IDF with a tuned SVM model achieves the best performance across all metrics, including accuracy, precision, recall, and F1 score. Other combinations, such as Random Forest with Word2Vec or even TF-IDF, consistently lagged behind, with their highest scores reaching only around 0.92 compared to 0.95 achieved by the tuned SVM model. These findings highlight the importance of fine-tuning hyperparameters and selecting robust text representation techniques like TF-IDF for achieving superior results in e-commerce product classification. This approach proves particularly effective for tasks requiring both accuracy and consistency in categorization.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteveee27%2Fe-commerce-product-description-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteveee27%2Fe-commerce-product-description-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteveee27%2Fe-commerce-product-description-classification/lists"}