GithubHelp home page GithubHelp logo

honglinglei / association-rule-mining Goto Github PK

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

Association analysis including support, confidence, and lift between consumer goods

Jupyter Notebook 100.00%
association-analysis algorithm-optimization

association-rule-mining's Introduction

README

Overview

I used supermarket receipts to analyze associations (support, confidence, lift, etc.) between consumer goods. Instead of employing Apriori Algorithm - the traditional solution - I used a simpler method (originally proposed by my friend Tianye Song) which generates the same results within a shorter execution time. Loops are avoided so it took only 0.04 second to analyze 9995 receipts.

Motivation

As Usman Malik wrote, "Association rule mining is a technique to identify underlying relations between different items. Take an example of a Super Market where customers can buy variety of items. Usually, there is a pattern in what the customers buy. For instance, mothers with babies buy baby products such as milk and diapers. Damsels may buy makeup items whereas bachelors may buy beers and chips etc. In short, transactions involve a pattern. More profit can be generated if the relationship between the items purchased in different transactions can be identified."

Data

Sample - SuperStore.xls is my raw data. It contains 9995 receipts; each has columns such as Row ID, Order ID, Order Date, Ship Date, Ship Mode, Customer ID, Customer Name, Segment, Country, City, State, Postal Code, Region, Product ID, Category, Sub-Category, Product Name, Sales, Quantity, Discount, Profit.

Code

The code is detailedly commented so each step should be easy to understand. As you can see, this optimized method does not contain any loop (my first version had 3 loops and 2 ifs) so it runs much faster.

Results

Demo results can be seen in my code file. The file includes XID, YID, n_XY, n_X, n_Y, n_Transactions, Support, Confidence, and Lift. Click here to download the complete excel.

Additional Reading

If you would like to know more about association rule mining, here are some suggested sources.

association-rule-mining's People

Contributors

honglinglei avatar

Stargazers

 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.