Skip to content

This Django-based E-commerce recommendation system uses machine learning models to provide product recommendations based on user input and similarity scores. It scrapes data from Amazon, preprocesses it, and displays product recommendations in a user-friendly interface.

License

Notifications You must be signed in to change notification settings

ShawonBarman/E-commerce_recommendation_system

Repository files navigation

E-commerce_recommendation_system

This project is a Django-based E-commerce recommendation system that uses a dataset scraped from Amazon to provide product recommendations to users. Here's a breakdown of the key components and functionality of your project:

  1. Project Structure: I have organized my Django project into two apps: 'recommendationSystem' (the main app) and 'myApp'.
  2. Data Scraping: I scraped data from the Amazon website to build a dataset. This dataset likely contains information about various products, including their titles, categories, sub-categories, prices, ratings, and other relevant attributes.
  3. Data Preprocessing: I used the scikit-learn library to perform data preprocessing, which includes feature transformation using a preprocessor and computing the cosine similarity matrix.
  4. Machine Learning Models: I have trained machine learning models for clustering (K-Means) and DBSCAN. These models are loaded using joblib for further use in the recommendation system.
  5. Recommendation Algorithm: The recommendation logic is primarily based on K-Means clustering and cosine similarity. When a user enters a product title, your system finds the cluster to which that product belongs and recommends other products within the same cluster based on cosine similarity scores.
  6. Django Views: My 'myApp/views.py' contains Django view functions for handling user requests. The 'home' view renders the main page, and the 'get_recommendations' function generates product recommendations. The 'recommend_products' view handles POST requests when a user submits a product title and displays recommendations on the same page.
  7. User Interface: I have created HTML templates (index.html) for the user interface, with input fields for users to enter product titles and a section to display recommended products. Bootstrap is used for styling.
  8. Routing and URLs: I have defined URL patterns in the 'urls.py' files for routing user requests to the appropriate views.
  9. Data Display: The recommended products are displayed in a responsive card layout, showing product details like title, category, sub-category, price, ratings, and total ratings.
  10. Static Files: Static files like CSS are loaded using '{% static %}' template tags.
  11. Database: In this project, I used a pre-built dataset (data.pkl) and machine learning models loaded from joblib files, rather than a database to store and retrieve product information.

Overall, my Django E-commerce recommendation system uses machine learning to provide product recommendations based on user input and similarity scores, offering a user-friendly interface for interaction. Users can input a product title, and the system will suggest similar products from the dataset based on the clustering and similarity calculations you've implemented.

Here are step-by-step instructions on how to run this Django-based E-commerce recommendation project in a user-friendly way:

  1. Download the Project from GitHub and Unzip: Look for a "Code" button on this GitHub page. Click on it and select "Download ZIP" to download the project as a ZIP archive. And then locate the downloaded ZIP file on your computer (usually in your "Downloads" folder). After that right-click the ZIP file and select "Extract" or "Extract All" (the exact option may vary depending on your operating system). Then choose a destination folder where you want to extract the project files.
  2. Navigate to Project Directory: Open the command prompt or terminal in this project root directory directly. Or open the command prompt or terminal on your computer and then use the 'cd' command to navigate to the root directory of this Django project. For example:
    • cd path/to/this/project
  3. Create a Virtual Environment: Create a virtual environment to isolate this project dependencies. This helps manage package versions.
    • python -m venv myenv
  4. Activate the Virtual Environment: Activate the virtual environment you just created. This ensures that the project uses the isolated environment.
    • myenv\Scripts\activate (Windows)
    • source myenv/bin/activate (macOS/Linux)
  5. Upgrade Pip: Upgrade the 'pip' tool to the latest version to ensure you have the most recent package manager.
    • python.exe -m pip install --upgrade pip
  6. Install Django and Required Packages: Install Django and the necessary Python packages for this project.
    • pip install django
    • pip install numpy
    • pip install pandas
    • pip install joblib
    • pip install scikit-learn==1.2.2
  7. Database Setup: Run the following commands to set up the database for this Django project:
    • python manage.py makemigrations
    • python manage.py migrate
  8. Run the Development Server: Start the Django development server to run this project locally:
    • python manage.py runserver
  9. Access This Project: Once the server is running, open a web browser and enter the following URL: 'http://localhost:8000/'. You should see this E-commerce recommendation system's home page.
  10. Interact with the Recommendation System: On the home page, you can enter a product title and click the "Recommend" button to get product recommendations based on your input.

Now this Django E-commerce recommendation project should be up and running locally. Users can access the recommendation system through their web browsers and receive product recommendations based on their input.

About

This Django-based E-commerce recommendation system uses machine learning models to provide product recommendations based on user input and similarity scores. It scrapes data from Amazon, preprocesses it, and displays product recommendations in a user-friendly interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published