Coder Social home page Coder Social logo

imsrbh / recsysassociationpy Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 122.65 MB

Collaborative Filtering and Association Rule Mining App

Dockerfile 0.03% Python 0.56% Jupyter Notebook 99.42%
apriori-algorithm association-rule-mining colaborative-filtering fpgrowth recommender-system

recsysassociationpy's Introduction

RecsysAssociationPy

Collaborative Filtering and Association Rule Mining App

This is a Python application that implements collaborative filtering for item recommendation and association rule mining based on the Apriori and FPGrowth algorithms. The app is built using Flask, a lightweight web framework for Python.

Requirements

To run this app, you need to have the following installed:

  • Python 3.7 or higher
  • Flask
  • pandas
  • mlxtend

You can install the required packages using the following command:

pip install -r requirements.txt

Dataset

The app uses the "OnlineRetail.csv" dataset for collaborative filtering and association rule mining. The dataset contains online retail transaction data. The app loads and preprocesses the data to create customer-item and item-item matrices for collaborative filtering.

How to Use : Docker [Suggested]

  1. Clone this repository to your local machine.

  2. Navigate to the project directory containing the Dockerfile.

  3. Build the Docker image by running the following command:

docker build -t collaborative-app .

Replace collaborative-app with the desired name for your Docker image.

  1. Once the image is built, run the Docker container using the following command:
docker run -p 5000:5000 collaborative-app
  1. The Flask app will now be running inside the Docker container. You can access it at http://localhost:5000 on your local machine.

How to Run Locally

python3.7 -m venv .env

source .env/bin/activate

pip3 install -r requirements.txt

python3 app.py 

Endpoints

The app provides the following endpoints:

  • /item-recommendation: Recommends similar items based on an input item ID.
  • /user-recommendation: Recommends items to one user based on the items purchased by another user.
  • /apriori-recommendation: Mines association rules using the Apriori algorithm and provides recommendations based on the rules.
  • /fpgrowth-recommendation: Mines association rules using the FPGrowth algorithm and provides recommendations based on the rules.

Example Usage

  1. To get item recommendations based on item ID 23167:
curl http://localhost:5000/item-recommendation?item_id=23167
  1. To get user-based item recommendations for users with IDs 12583 and 13047:
curl http://localhost:5000/user-recommendation?user_idA=12583&user_idB=13047
  1. To mine association rules using apriori and get recommendations based on the rules:
curl http://localhost:5000/apriori-recommendation?min_support=0.01&min_threshold=0.5
  1. To mine association rules using fpgrowth and get recommendations based on the rules:
curl http://127.0.0.1:5000/fpgrowth-recommendation?min_support=0.01&min_threshold=0.5

Notes

  • The app uses cosine similarity for collaborative filtering.
  • The Apriori and FPGrowth algorithms are used for association rule mining.
  • The dataset should be placed in the project directory and named "OnlineRetail.csv".

recsysassociationpy's People

Contributors

imsrbh 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.