Giter Club home page Giter Club logo

apriori-algorithm-2's Introduction

apriori-algorithm

The Apriori algorithm detects frequent subsets given a dataset of association rules.

This Python 3 implementation first prompts the user for the minimum support threshold to be used in the Apriori algorithm. For example, if the minimum support was 3, then on subsets with a support of 3 or higher are included.

Using the script

Here is an example using the provided dataset and a minimum support of 6:

$ python apriori.py 
What min. support do you want to use? 
6

**** Apriori with minSupport = 6 ****

Sets:

frozenset(['a'])
frozenset(['b'])
frozenset(['c'])
frozenset(['a', 'b'])
frozenset(['a', 'c'])
frozenset(['c', 'b'])
frozenset(['a', 'c', 'b'])

Counts:

(frozenset(['a', 'c', 'b']), 3)
(frozenset(['d']), 5)
(frozenset(['b']), 7)
(frozenset(['a']), 8)
(frozenset(['e']), 3)
(frozenset(['c', 'b']), 5)
(frozenset(['a', 'c']), 4)
(frozenset(['c']), 6)
(frozenset(['a', 'b']), 5)

Changing dataset to use with your own data

The given data set is named 'Dataset-apriori.txt'. To use your own data you should use a csv format, then you just have to change line 58 in 'apriori.py' to reflect your own file name:

dataSetFilename = 'Dataset-apriori.txt'

apriori-algorithm-2's People

Contributors

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