Git Product home page Git Product logo

sugatagh / e-commerce-text-classification Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 4.0 11.13 MB

Proper categorization of e-commerce products enhances the user experience and achieves better results with external search engines. The objective of the project is to classify a product into four given categories, based on its description available on an e-commerce platform.

License: MIT License

Jupyter Notebook 100.00%
e-commerce natural-language-processing product-categorization text-classification text-normalization tf-idf word2vec

e-commerce-text-classification's Introduction

E-commerce Text Classification

Project Report

https://sugatagh.github.io/dsml/projects/e-commerce-text-classification/

Kaggle Notebook

https://www.kaggle.com/code/sugataghosh/e-commerce-text-classification-tf-idf-word2vec

E-commerce Product Categorization

E-commerce (electronic commerce) is the activity of electronically buying or selling of products on online services or over the Internet. It frequently uses the web, if not entirely, for at least some of the life cycle of a transaction, while it may also use other technologies like e-mail. Typical e-commerce transactions include the purchase of products (like books from Amazon) or services (such as music downloads in the form of digital distribution such as the iTunes Store). Online retail, electronic markets, and online auctions are the three areas of e-commerce. E-commerce is supported by electronic business. The purpose of e-commerce is to enable customers to shop and pay online over the Internet, saving both time and space for consumers and businesses while also significantly improving transaction efficiency.

Product categorization or product classification is a type of economic taxonomy that refers to a system of categories into which a collection of products would fall under. Product categorization involves two separate tasks:

  • Create, support, and expand the catalogue structure for the offered products
  • Tagging products with the correct categories and attributes

While machine learning does not have much potential for use in the first task, it is possible to automate the second task, which is relatively laborious and time-consuming. The problem considered in this notebook involves the categorization of products offered on e-commerce platforms based on the descriptions of the products mentioned therein. The purpose of such categorization is to enhance the user experience and achieve better results with external search engines. Visitors can quickly find the products they need by navigating the catalogue or using the website's search engine.

Text Classification

Text classification is a widely used natural language processing task in different business problems. Given a statement or document, the task involves assigning to it an appropriate category from a pre-defined set of categories. The dataset of choice determines the set of categories. Text classification has applications in emotion classification, news classification, spam email detection, auto-tagging of customer queries etc.

In the present problem, the statements are the product descriptions and the categories are Electronics, Household, Books and Clothing & Accessories.

Data

Original source: https://doi.org/10.5281/zenodo.3355823

Kaggle dataset: https://www.kaggle.com/datasets/saurabhshahane/ecommerce-text-classification

The dataset has been scraped from Indian e-commerce platform(s). It contains e-commerce text data for four categories: Electronics, Household, Books and Clothing & Accessories. Roughly speaking, these four categories cover $80$% of any e-commerce website, by and large. The dataset is in .csv format and consists of two columns. The first column gives the target class name and the second column gives the datapoint, which is the description of the product from the e-commerce website.

Project Objective

The objective of the project is to classify e-commerce products into four categories, based on its description available in the e-commerce platforms. The categories are:

  • Electronics
  • Household
  • Books
  • Clothing & Accessories

Overview

  • We perform exploratory data analysis on the dataset.

  • We consider a number of text normalization techniques for product descriptions.

  • We use TF-IDF vectorizer on the normalized product descriptions for text vectorization, compared the baseline performance of several classifiers, and perform hyperparameter tuning on the support vector machine classifier with linear kernel. The tuned model obtains a validation accuracy of $0.952158$.

  • In another direction, we employ a few selected text normalization processes on the raw data on product descriptions. Then, we use Google's pre-trained Word2Vec model on the tokens, obtained from the partially normalized descriptions, to get the embeddings, which are converted to compressed sparse row (CSR) format. The baseline performance of several classifiers are compared. Finally, we perform hyperparameter tuning on the XGBoost classifier. The tuned model obtains a validation accuracy of $0.948561$.

  • We employ the tuned model with the highest validation accuracy to predict the labels of the test observations and obtained a test accuracy of $0.948939$. We present the confusion matrix depicting the test set performance of the model.

e-commerce-text-classification's People

Contributors

sugatagh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.