Git Product home page Git Product logo

apriori-algorithm-to-discover-association-rules's Introduction

Apriori-algorithm-to-discover-association-rules

Code Explanation:

1. Data Import and Exploration:

Import necessary libraries and read the dataset from a CSV file.
Display the first few rows of the dataset.
Check for missing values in each column.
Get information about the dataset.
Convert the 'Date' column to datetime format.

2. Top 10 Sold Items Bar Plot:

Group the dataset by "itemDescription" and calculate the frequency of each item.
Select the top 10 items with the highest frequency.
Create a horizontal bar plot to visualize the top 10 sold items.

3. Number of Items Sold by Month:

Set the 'Date' column as the index of the dataframe.
Resample the data by month and count the number of items sold.
Create a line plot to show the number of items sold over time.

4. Association Rule Mining:

Sort the dataset by "Member_number" in descending order.
Retrieve the list of transactions for each customer.
Apply the Apriori algorithm to find association rules.
Specify the minimum support, confidence, lift, and length of rules.
Store the results of the association rule mining.

5. Confusion Matrix and Accuracy:

Define the ground truth rules and discovered rules as dataframes.
Get the unique labels from both sets of rules.
Create a confusion matrix using the ground truth and discovered rules.
Convert the confusion matrix to a dataframe.
Visualize the confusion matrix using a heatmap.
Calculate and display the accuracy of the discovered rules.

6. Summary Statistics and Visualizations:

Create a dataframe with summary statistics of the discovered rules.
Plot a histogram of the support values.
Create a scatter plot of confidence versus lift.
Generate a bar plot of left-hand side items versus support.
Display a heatmap of the correlation between support, confidence, and lift.

apriori-algorithm-to-discover-association-rules's People

Contributors

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