Skip to content

Commit

Permalink
Added Association Rule Leaning Models and dataset. Updated the README
Browse files Browse the repository at this point in the history
  • Loading branch information
screwgoth committed Jun 2, 2020
1 parent 9640bb1 commit 6f6cf55
Show file tree
Hide file tree
Showing 3 changed files with 7,674 additions and 2 deletions.
169 changes: 169 additions & 0 deletions Association Rule Learning/Apriori/apriori.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "1fziHl7Ar94J"
},
"source": [
"# Apriori"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "eiNwni1xsEgT"
},
"source": [
"## Importing the libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "UJfitBClsJlT"
},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "vLt-7XUKsXBd"
},
"source": [
"## Data Preprocessing"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "J_A-UFOAsaDf"
},
"outputs": [],
"source": [
"dataset = pd.read_csv('../../datasets/Market_Basket_Optimisation.csv', header = None)\n",
"transactions = []\n",
"for i in range(0, 7501):\n",
" transactions.append([str(dataset.values[i,j]) for j in range(0, 20)])"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "1wYZdBd5sea_"
},
"source": [
"## Training the Apriori model on the dataset"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "YzIk4vXZsj5i"
},
"outputs": [],
"source": [
"# WARNING: Make sure to upload the apyori.py file into this Colab notebook before running this cell\n",
"from apyori import apriori\n",
"rules = apriori(transactions, min_support = 0.003, min_confidence = 0.2, min_lift = 3, min_length = 2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "b176YNwWspiO"
},
"source": [
"## Visualising the results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "a4ZyVYazsvWt"
},
"outputs": [],
"source": [
"results = list(rules)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 54
},
"colab_type": "code",
"executionInfo": {
"elapsed": 941,
"status": "ok",
"timestamp": 1586415085286,
"user": {
"displayName": "Hadelin de Ponteves",
"photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhEuXdT7eQweUmRPW8_laJuPggSK6hfvpl5a6WBaA=s64",
"userId": "15047218817161520419"
},
"user_tz": -240
},
"id": "FdaOb_95tQoP",
"outputId": "701cb6ce-3951-4c6e-9140-c867741bd885"
},
"outputs": [],
"source": [
"print(results)"
]
}
],
"metadata": {
"colab": {
"authorship_tag": "ABX9TyO41Q6DRmOTeVEfityPN5hB",
"collapsed_sections": [],
"name": "Apriori",
"provenance": [],
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ The repository is composed of the following sections:
* Support Vector Regression
* Decision Tree Regression
* Random Forest Regression
* `Classification` : this folder contains Jupyter notebooks for the following Classification Models:
* `Classification` : This folder contains Jupyter notebooks for the following Classification Models:
* Logistic Regression
* K - Nearest Neighbor (K-NN)
* Support Vector Machine (SVM)
* Kernel SVM
* Naive Bayes
* Decision Tree Classification
* Random Forest Classification
* `Clustering` : This folder contain Jupyter notebooks for the following Clustering Models:
* `Clustering` : This folder contains Jupyter notebooks for the following Clustering Models:
* K-Means Clustering
* Hierarchical Clustering
* `Association Rule Learning` : This folder contains Jupyter notebooks for the following Association Rule Learning Models:
* Apriori



Expand Down
Loading

0 comments on commit 6f6cf55

Please sign in to comment.