From dbd10d21056c65e494d4f5244499fb4d9de9d1ba Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 11:26:46 +0530 Subject: [PATCH 01/10] Created using Colab --- .../basic/test_fcpgrowth_cases.ipynb | 883 ++++++++++++++++++ 1 file changed, 883 insertions(+) create mode 100644 tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_cases.ipynb diff --git a/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_cases.ipynb b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_cases.ipynb new file mode 100644 index 00000000..b75aa781 --- /dev/null +++ b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_cases.ipynb @@ -0,0 +1,883 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyOjLhHOyol72vjdn+jLSoEq" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ixvJmwm09QWD", + "outputId": "b3aac0da-01e6-45dc-938b-588e78a9c64c" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting PAMI\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.7.1)\n", + "Collecting resource (from PAMI)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from PAMI)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m1.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from PAMI) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from PAMI) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from PAMI)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m21.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from PAMI)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m32.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.3)\n", + "Collecting deprecated (from PAMI)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->PAMI) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->PAMI) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->PAMI) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->PAMI)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->PAMI)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->PAMI) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->PAMI) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->PAMI) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->PAMI) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=a9cb8380c676784a666e8bbf352f383fa18a25a9de0bb74500f773c716e2ccdd\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=cec95b4d616613531d09ee03c84699849390aea1c438ee663841823414d43d09\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, PAMI\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 PAMI-2024.6.10 deprecated-1.2.14 discord.py-2.3.2 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install -U PAMI" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for Fuzzy_T10I4D100K Dataset ##\n", + "\n" + ], + "metadata": { + "id": "TsK8EpAO-yBu" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "rOcM7hPS-m5a" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FCPGrowth\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(URL, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "pZprgPkS-wJh", + "outputId": "260c166e-2e6c-4e25-8227-aeb409a11832" + }, + "execution_count": 23, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 47 38.138874 482811904\n", + "1 FCPGrowth 3500 32 29.634952 474365952\n", + "2 FCPGrowth 4000 21 21.081635 468803584\n", + "3 FCPGrowth 4500 13 19.862157 468803584\n", + "4 FCPGrowth 5000 8 16.206319 468803584\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "d8LocZCCMZx5" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv #download a sample fuzzy database" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "q3WrCDEsCaNS", + "outputId": "0d45493f-d072-416d-8da4-45304b34036b" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 03:56:02-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 2.18MB/s in 6.8s \n", + "\n", + "2024-06-15 03:56:10 (1.28 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-kgCK13-A8IV", + "outputId": "bf1505a3-e60e-44ee-e1b8-4e770840d989" + }, + "execution_count": 24, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 47 28.714280 483241984\n", + "1 FCPGrowth 3500 32 17.176297 491769856\n", + "2 FCPGrowth 4000 21 12.506592 477171712\n", + "3 FCPGrowth 4500 13 9.736856 475090944\n", + "4 FCPGrowth 5000 8 8.046227 475189248\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "XpTgvGh2MzIx" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FCPGrowth', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-fXGLkDrM1Y7", + "outputId": "68484ecb-3153-413b-a9cf-a80b81469a31" + }, + "execution_count": 26, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 47 30.410480 539758592\n", + "1 FCPGrowth 3500 32 17.582543 506204160\n", + "2 FCPGrowth 4000 21 12.662806 506204160\n", + "3 FCPGrowth 4500 13 9.556901 518688768\n", + "4 FCPGrowth 5000 8 7.309658 505257984\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for Retail Dataset ##" + ], + "metadata": { + "id": "1RJqb9HAPick" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for Retail Dataset ###" + ], + "metadata": { + "id": "1Vx_thr3PzA6" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FCPGrowth\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(URL, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "k3TKGsQOP6Dj", + "outputId": "8719ed41-4108-489b-d220-c1763fbb8ed8" + }, + "execution_count": 29, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 3 30.937624 596226048\n", + "1 FCPGrowth 3500 2 26.002422 592297984\n", + "2 FCPGrowth 4000 3 29.892440 589156352\n", + "3 FCPGrowth 4500 2 28.526143 587059200\n", + "4 FCPGrowth 5000 2 28.234819 584953856\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for Retail Dataset ###" + ], + "metadata": { + "id": "cMQ1c35jTZgq" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "M6x83Of5TdnT", + "outputId": "b7e65f0e-7d04-430a-cfff-43f1221079a1" + }, + "execution_count": 30, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 05:11:19-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 12342035 (12M) [text/csv]\n", + "Saving to: ‘Fuzzy_retail.csv’\n", + "\n", + "Fuzzy_retail.csv 100%[===================>] 11.77M 2.40MB/s in 8.9s \n", + "\n", + "2024-06-15 05:11:30 (1.32 MB/s) - ‘Fuzzy_retail.csv’ saved [12342035/12342035]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "vHE-mUzeTw84", + "outputId": "2c0c951e-3a76-4be4-9f50-75f61bc71f57" + }, + "execution_count": 31, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 3 18.041836 596332544\n", + "1 FCPGrowth 3500 2 20.770245 612945920\n", + "2 FCPGrowth 4000 3 17.755379 611872768\n", + "3 FCPGrowth 4500 2 18.129359 586948608\n", + "4 FCPGrowth 5000 2 16.147533 600211456\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for Retail dataset" + ], + "metadata": { + "id": "8NhZlW_cUP7B" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FCPGrowth', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qTCqm5lfUT-K", + "outputId": "159a284a-4b04-48a1-c954-9590228a3c39" + }, + "execution_count": 32, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 3 19.317794 666357760\n", + "1 FCPGrowth 3500 2 16.878988 679071744\n", + "2 FCPGrowth 4000 3 16.980136 633053184\n", + "3 FCPGrowth 4500 2 20.583134 712544256\n", + "4 FCPGrowth 5000 2 17.565883 628703232\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for T20I6D100K Database ##" + ], + "metadata": { + "id": "F8313W3BUw4v" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for T20I6D100K Database ###" + ], + "metadata": { + "id": "VUaUdpC2U6_6" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FCPGrowth\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(URL, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "r6uNZbqIVAsR", + "outputId": "b36d2df9-b7b7-432b-d5bf-faff1b95b9ce" + }, + "execution_count": 43, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 6000 42 57.264177 1166438400\n", + "1 FCPGrowth 6500 34 51.450313 1164357632\n", + "2 FCPGrowth 7000 27 40.667873 1164357632\n", + "3 FCPGrowth 8500 9 31.101558 1164357632\n", + "4 FCPGrowth 9000 8 24.453143 1164357632\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for T20I6D100K Database ###" + ], + "metadata": { + "id": "INKnJdSYZ4SM" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "URzra-Dzazu1", + "outputId": "a9db8772-9942-4678-9d68-6285b5b99522" + }, + "execution_count": 44, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 05:43:10-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 17657765 (17M) [text/csv]\n", + "Saving to: ‘Fuzzy_T20I6D100K.csv’\n", + "\n", + "Fuzzy_T20I6D100K.cs 100%[===================>] 16.84M 3.01MB/s in 11s \n", + "\n", + "2024-06-15 05:43:23 (1.51 MB/s) - ‘Fuzzy_T20I6D100K.csv’ saved [17657765/17657765]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FCPGrowth', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "GIzQz_T9bYqR", + "outputId": "015f9664-4af9-4394-8b63-7df34a98a66a" + }, + "execution_count": 45, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 6000 42 55.715518 1164357632\n", + "1 FCPGrowth 6500 34 34.064637 1164357632\n", + "2 FCPGrowth 7000 27 30.517954 1163325440\n", + "3 FCPGrowth 8500 9 15.670099 1163325440\n", + "4 FCPGrowth 9000 8 16.341662 1163325440\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for T20I6D100K Database ###" + ], + "metadata": { + "id": "UVlHa-Dxcd1n" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of Apriori\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FCPGrowth(inputFile, minSup=minSupCount,minAllConf=minAllConf, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FCPGrowth', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FCPGrowth algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "2H5isHK8cgRK", + "outputId": "cd9a6ba4-d777-4e9b-fffa-77ae9701139d" + }, + "execution_count": 46, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Frequent patterns were generated successfully using FCPGrowth algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 6000 42 48.852129 1120514048\n", + "1 FCPGrowth 6500 34 37.504079 1114189824\n", + "2 FCPGrowth 7000 27 30.127846 1086091264\n", + "3 FCPGrowth 8500 9 19.061869 1112043520\n", + "4 FCPGrowth 9000 8 15.407887 1084813312\n" + ] + } + ] + } + ] +} \ No newline at end of file From 3ec081d1d8c49c0abc599dcb605114d9b51b7c76 Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:20:25 +0530 Subject: [PATCH 02/10] Created using Colab --- .../basic/test_fcpgrowth_terminal.ipynb | 285 ++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb diff --git a/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb b/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb new file mode 100644 index 00000000..ee9742df --- /dev/null +++ b/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb @@ -0,0 +1,285 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyMa54a+1RZs9JotLpML/pGQ" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "seBO_8ZKe4ZA", + "outputId": "3f514825-61de-4dd6-d15a-1b3d5bba5989" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting PAMI\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.7.1)\n", + "Collecting resource (from PAMI)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from PAMI)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from PAMI) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from PAMI) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from PAMI)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from PAMI)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.3)\n", + "Collecting deprecated (from PAMI)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->PAMI) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->PAMI) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->PAMI) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->PAMI)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->PAMI)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->PAMI) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->PAMI) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->PAMI) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->PAMI) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=7a3be3fcfb39d3028b80c1ea612cf61a8d1ed823d4faa0369a02cb49df9ffb32\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=61fb8ddfa8741559d64d2baea947d3ec12f6d30825aa49d1fa7ae372a86cc2d7\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, PAMI\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 PAMI-2024.6.10 deprecated-1.2.14 discord.py-2.3.2 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install PAMI" + ] + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "cehjt4KgfHiv", + "outputId": "f501b82f-5a90-43bf-a8fb-1d4a6a5f5e32" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 06:44:51-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 2.43MB/s in 3.9s \n", + "\n", + "2024-06-15 06:44:56 (2.22 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8 \"\\t\"" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yjAqTFVIoE0C", + "outputId": "81518343-0dd7-48ba-ea7d-5f0daa4d21c2" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 5\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8', '\\\\t']\n", + "Input File: /content/Fuzzy_T10I4D100K.csv\n", + "Minimum Support List: 2500\n", + "ratioExample: 0.8\n", + "Separator: \t\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Total number of Frequent Patterns: 93\n", + "Total Memory in USS: 257929216\n", + "Total Memory in RSS: 277008384\n", + "Total ExecutionTime in ms: 67.81151151657104\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lQ_x4Ov9pf6f", + "outputId": "3688edc6-bd89-4cc2-b80e-0e676ecb238a" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 4\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8']\n", + "Input File: /content/Fuzzy_T10I4D100K.csv\n", + "Minimum Support List: 2500\n", + "Minimum ALL CONF: 0.8\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Total number of Frequent Patterns: 93\n", + "Total Memory in USS: 257617920\n", + "Total Memory in RSS: 276590592\n", + "Total ExecutionTime in ms: 67.12039136886597\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dT1Hn3_tqBZn", + "outputId": "9b8e9481-9155-4d5c-af58-d46e4c4e52e3" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 3\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500']\n", + "Traceback (most recent call last):\n", + " File \"/content/FCPGrowth.py\", line 808, in \n", + " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", + "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", + "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "kNb9Qf9GqG7i", + "outputId": "656f5658-5862-4e4e-8f41-b77e629e0dd5" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 2\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv']\n", + "Traceback (most recent call last):\n", + " File \"/content/FCPGrowth.py\", line 808, in \n", + " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", + "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", + "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" + ] + } + ] + } + ] +} \ No newline at end of file From b4aff0d3cb236914ea94b2a94347039345a34177 Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:21:42 +0530 Subject: [PATCH 03/10] Created using Colab --- .../basic/test_fcpgrowth_terminal.ipynb | 285 ++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_terminal.ipynb diff --git a/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_terminal.ipynb b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_terminal.ipynb new file mode 100644 index 00000000..ee9742df --- /dev/null +++ b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth_terminal.ipynb @@ -0,0 +1,285 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyMa54a+1RZs9JotLpML/pGQ" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "seBO_8ZKe4ZA", + "outputId": "3f514825-61de-4dd6-d15a-1b3d5bba5989" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting PAMI\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.7.1)\n", + "Collecting resource (from PAMI)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from PAMI)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from PAMI) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from PAMI) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from PAMI)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from PAMI)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.3)\n", + "Collecting deprecated (from PAMI)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->PAMI) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->PAMI) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->PAMI) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->PAMI)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->PAMI)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->PAMI)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->PAMI) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->PAMI) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->PAMI) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->PAMI) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=7a3be3fcfb39d3028b80c1ea612cf61a8d1ed823d4faa0369a02cb49df9ffb32\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=61fb8ddfa8741559d64d2baea947d3ec12f6d30825aa49d1fa7ae372a86cc2d7\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, PAMI\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 PAMI-2024.6.10 deprecated-1.2.14 discord.py-2.3.2 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install PAMI" + ] + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "cehjt4KgfHiv", + "outputId": "f501b82f-5a90-43bf-a8fb-1d4a6a5f5e32" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 06:44:51-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 2.43MB/s in 3.9s \n", + "\n", + "2024-06-15 06:44:56 (2.22 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8 \"\\t\"" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yjAqTFVIoE0C", + "outputId": "81518343-0dd7-48ba-ea7d-5f0daa4d21c2" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 5\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8', '\\\\t']\n", + "Input File: /content/Fuzzy_T10I4D100K.csv\n", + "Minimum Support List: 2500\n", + "ratioExample: 0.8\n", + "Separator: \t\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Total number of Frequent Patterns: 93\n", + "Total Memory in USS: 257929216\n", + "Total Memory in RSS: 277008384\n", + "Total ExecutionTime in ms: 67.81151151657104\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lQ_x4Ov9pf6f", + "outputId": "3688edc6-bd89-4cc2-b80e-0e676ecb238a" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 4\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8']\n", + "Input File: /content/Fuzzy_T10I4D100K.csv\n", + "Minimum Support List: 2500\n", + "Minimum ALL CONF: 0.8\n", + "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", + "Total number of Frequent Patterns: 93\n", + "Total Memory in USS: 257617920\n", + "Total Memory in RSS: 276590592\n", + "Total ExecutionTime in ms: 67.12039136886597\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dT1Hn3_tqBZn", + "outputId": "9b8e9481-9155-4d5c-af58-d46e4c4e52e3" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 3\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500']\n", + "Traceback (most recent call last):\n", + " File \"/content/FCPGrowth.py\", line 808, in \n", + " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", + "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", + "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "kNb9Qf9GqG7i", + "outputId": "656f5658-5862-4e4e-8f41-b77e629e0dd5" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Number of arguments: 2\n", + "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv']\n", + "Traceback (most recent call last):\n", + " File \"/content/FCPGrowth.py\", line 808, in \n", + " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", + "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", + "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" + ] + } + ] + } + ] +} \ No newline at end of file From 34a3cdbd5414ec8aa80cf2950e3cf397fdb51045 Mon Sep 17 00:00:00 2001 From: Lasya Date: Sat, 15 Jun 2024 12:25:24 +0530 Subject: [PATCH 04/10] Revert "Created using Colab" This reverts commit 3ec081d1d8c49c0abc599dcb605114d9b51b7c76. --- .../basic/test_fcpgrowth_terminal.ipynb | 285 ------------------ 1 file changed, 285 deletions(-) delete mode 100644 tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb diff --git a/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb b/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb deleted file mode 100644 index ee9742df..00000000 --- a/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb +++ /dev/null @@ -1,285 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "authorship_tag": "ABX9TyMa54a+1RZs9JotLpML/pGQ" - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "seBO_8ZKe4ZA", - "outputId": "3f514825-61de-4dd6-d15a-1b3d5bba5989" - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Collecting PAMI\n", - " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.9.5)\n", - "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.3)\n", - "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.15.0)\n", - "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.7.1)\n", - "Collecting resource (from PAMI)\n", - " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", - "Collecting validators (from PAMI)\n", - " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.7)\n", - "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from PAMI) (9.4.0)\n", - "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from PAMI) (1.25.2)\n", - "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.0.2)\n", - "Collecting sphinx-rtd-theme (from PAMI)\n", - " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting discord.py (from PAMI)\n", - " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.3)\n", - "Collecting deprecated (from PAMI)\n", - " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", - "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->PAMI) (1.14.1)\n", - "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->PAMI) (3.9.5)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.2.1)\n", - "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (4.53.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.4.5)\n", - "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (24.1)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (3.1.2)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (2.8.2)\n", - "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2023.4)\n", - "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2024.1)\n", - "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->PAMI) (8.3.0)\n", - "Collecting JsonForm>=0.0.2 (from resource->PAMI)\n", - " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting JsonSir>=0.0.2 (from resource->PAMI)\n", - " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting python-easyconfig>=0.1.0 (from resource->PAMI)\n", - " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", - "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.8)\n", - "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.6)\n", - "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.1)\n", - "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.0.5)\n", - "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.1.10)\n", - "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.7)\n", - "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (3.1.4)\n", - "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.16.1)\n", - "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.18.1)\n", - "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.2.0)\n", - "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.15.0)\n", - "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.7.16)\n", - "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.4.1)\n", - "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.31.0)\n", - "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->PAMI)\n", - " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.3.1)\n", - "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (23.2.0)\n", - "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.4.1)\n", - "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (6.0.5)\n", - "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.9.4)\n", - "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (4.0.3)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->PAMI) (2.1.5)\n", - "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->PAMI) (4.19.2)\n", - "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->PAMI) (1.16.0)\n", - "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->PAMI) (6.0.1)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.7)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (2024.6.2)\n", - "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (2023.12.1)\n", - "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.35.1)\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.18.1)\n", - "Building wheels for collected packages: JsonForm, JsonSir\n", - " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=7a3be3fcfb39d3028b80c1ea612cf61a8d1ed823d4faa0369a02cb49df9ffb32\n", - " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", - " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=61fb8ddfa8741559d64d2baea947d3ec12f6d30825aa49d1fa7ae372a86cc2d7\n", - " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", - "Successfully built JsonForm JsonSir\n", - "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, PAMI\n", - "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 PAMI-2024.6.10 deprecated-1.2.14 discord.py-2.3.2 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" - ] - } - ], - "source": [ - "!pip install PAMI" - ] - }, - { - "cell_type": "code", - "source": [ - "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "cehjt4KgfHiv", - "outputId": "f501b82f-5a90-43bf-a8fb-1d4a6a5f5e32" - }, - "execution_count": 4, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "--2024-06-15 06:44:51-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", - "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", - "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", - "HTTP request sent, awaiting response... 200 OK\n", - "Length: 9151461 (8.7M) [text/csv]\n", - "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", - "\n", - "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 2.43MB/s in 3.9s \n", - "\n", - "2024-06-15 06:44:56 (2.22 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8 \"\\t\"" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "yjAqTFVIoE0C", - "outputId": "81518343-0dd7-48ba-ea7d-5f0daa4d21c2" - }, - "execution_count": 5, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 5\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8', '\\\\t']\n", - "Input File: /content/Fuzzy_T10I4D100K.csv\n", - "Minimum Support List: 2500\n", - "ratioExample: 0.8\n", - "Separator: \t\n", - "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", - "Total number of Frequent Patterns: 93\n", - "Total Memory in USS: 257929216\n", - "Total Memory in RSS: 277008384\n", - "Total ExecutionTime in ms: 67.81151151657104\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "lQ_x4Ov9pf6f", - "outputId": "3688edc6-bd89-4cc2-b80e-0e676ecb238a" - }, - "execution_count": 6, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 4\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8']\n", - "Input File: /content/Fuzzy_T10I4D100K.csv\n", - "Minimum Support List: 2500\n", - "Minimum ALL CONF: 0.8\n", - "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", - "Total number of Frequent Patterns: 93\n", - "Total Memory in USS: 257617920\n", - "Total Memory in RSS: 276590592\n", - "Total ExecutionTime in ms: 67.12039136886597\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dT1Hn3_tqBZn", - "outputId": "9b8e9481-9155-4d5c-af58-d46e4c4e52e3" - }, - "execution_count": 7, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 3\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500']\n", - "Traceback (most recent call last):\n", - " File \"/content/FCPGrowth.py\", line 808, in \n", - " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", - "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", - "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "kNb9Qf9GqG7i", - "outputId": "656f5658-5862-4e4e-8f41-b77e629e0dd5" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 2\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv']\n", - "Traceback (most recent call last):\n", - " File \"/content/FCPGrowth.py\", line 808, in \n", - " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", - "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", - "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" - ] - } - ] - } - ] -} \ No newline at end of file From fcb8fa358b57593b94eb1fa2f74bc83ab77a0b2d Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:31:49 +0530 Subject: [PATCH 05/10] Delete tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb Accidently added to different folder. --- .../basic/test_fcpgrowth_terminal.ipynb | 285 ------------------ 1 file changed, 285 deletions(-) delete mode 100644 tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb diff --git a/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb b/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb deleted file mode 100644 index ee9742df..00000000 --- a/tests/frequentPattern/basic/test_fcpgrowth_terminal.ipynb +++ /dev/null @@ -1,285 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "authorship_tag": "ABX9TyMa54a+1RZs9JotLpML/pGQ" - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "seBO_8ZKe4ZA", - "outputId": "3f514825-61de-4dd6-d15a-1b3d5bba5989" - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Collecting PAMI\n", - " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.9.5)\n", - "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.3)\n", - "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.15.0)\n", - "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.7.1)\n", - "Collecting resource (from PAMI)\n", - " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", - "Collecting validators (from PAMI)\n", - " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from PAMI) (2.0.7)\n", - "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from PAMI) (9.4.0)\n", - "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from PAMI) (1.25.2)\n", - "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from PAMI) (5.0.2)\n", - "Collecting sphinx-rtd-theme (from PAMI)\n", - " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting discord.py (from PAMI)\n", - " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from PAMI) (3.3)\n", - "Collecting deprecated (from PAMI)\n", - " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", - "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->PAMI) (1.14.1)\n", - "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->PAMI) (3.9.5)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.2.1)\n", - "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (4.53.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (1.4.5)\n", - "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (24.1)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (3.1.2)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->PAMI) (2.8.2)\n", - "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2023.4)\n", - "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->PAMI) (2024.1)\n", - "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->PAMI) (8.3.0)\n", - "Collecting JsonForm>=0.0.2 (from resource->PAMI)\n", - " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting JsonSir>=0.0.2 (from resource->PAMI)\n", - " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting python-easyconfig>=0.1.0 (from resource->PAMI)\n", - " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", - "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.8)\n", - "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.6)\n", - "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.1)\n", - "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.0.5)\n", - "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.1.10)\n", - "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.0.7)\n", - "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (3.1.4)\n", - "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.16.1)\n", - "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.18.1)\n", - "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.2.0)\n", - "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.15.0)\n", - "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (0.7.16)\n", - "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (1.4.1)\n", - "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->PAMI) (2.31.0)\n", - "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->PAMI)\n", - " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.3.1)\n", - "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (23.2.0)\n", - "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.4.1)\n", - "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (6.0.5)\n", - "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (1.9.4)\n", - "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->PAMI) (4.0.3)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->PAMI) (2.1.5)\n", - "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->PAMI) (4.19.2)\n", - "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->PAMI) (1.16.0)\n", - "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->PAMI) (6.0.1)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (3.7)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->PAMI) (2024.6.2)\n", - "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (2023.12.1)\n", - "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.35.1)\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->PAMI) (0.18.1)\n", - "Building wheels for collected packages: JsonForm, JsonSir\n", - " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=7a3be3fcfb39d3028b80c1ea612cf61a8d1ed823d4faa0369a02cb49df9ffb32\n", - " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", - " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=61fb8ddfa8741559d64d2baea947d3ec12f6d30825aa49d1fa7ae372a86cc2d7\n", - " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", - "Successfully built JsonForm JsonSir\n", - "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, PAMI\n", - "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 PAMI-2024.6.10 deprecated-1.2.14 discord.py-2.3.2 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" - ] - } - ], - "source": [ - "!pip install PAMI" - ] - }, - { - "cell_type": "code", - "source": [ - "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "cehjt4KgfHiv", - "outputId": "f501b82f-5a90-43bf-a8fb-1d4a6a5f5e32" - }, - "execution_count": 4, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "--2024-06-15 06:44:51-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", - "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", - "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", - "HTTP request sent, awaiting response... 200 OK\n", - "Length: 9151461 (8.7M) [text/csv]\n", - "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", - "\n", - "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 2.43MB/s in 3.9s \n", - "\n", - "2024-06-15 06:44:56 (2.22 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8 \"\\t\"" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "yjAqTFVIoE0C", - "outputId": "81518343-0dd7-48ba-ea7d-5f0daa4d21c2" - }, - "execution_count": 5, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 5\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8', '\\\\t']\n", - "Input File: /content/Fuzzy_T10I4D100K.csv\n", - "Minimum Support List: 2500\n", - "ratioExample: 0.8\n", - "Separator: \t\n", - "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", - "Total number of Frequent Patterns: 93\n", - "Total Memory in USS: 257929216\n", - "Total Memory in RSS: 277008384\n", - "Total ExecutionTime in ms: 67.81151151657104\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500 0.8" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "lQ_x4Ov9pf6f", - "outputId": "3688edc6-bd89-4cc2-b80e-0e676ecb238a" - }, - "execution_count": 6, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 4\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500', '0.8']\n", - "Input File: /content/Fuzzy_T10I4D100K.csv\n", - "Minimum Support List: 2500\n", - "Minimum ALL CONF: 0.8\n", - "Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms\n", - "Total number of Frequent Patterns: 93\n", - "Total Memory in USS: 257617920\n", - "Total Memory in RSS: 276590592\n", - "Total ExecutionTime in ms: 67.12039136886597\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv 2500" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "dT1Hn3_tqBZn", - "outputId": "9b8e9481-9155-4d5c-af58-d46e4c4e52e3" - }, - "execution_count": 7, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 3\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv', '2500']\n", - "Traceback (most recent call last):\n", - " File \"/content/FCPGrowth.py\", line 808, in \n", - " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", - "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", - "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!python /content/FCPGrowth.py /content/Fuzzy_T10I4D100K.csv" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "kNb9Qf9GqG7i", - "outputId": "656f5658-5862-4e4e-8f41-b77e629e0dd5" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Number of arguments: 2\n", - "Arguments: ['/content/FCPGrowth.py', '/content/Fuzzy_T10I4D100K.csv']\n", - "Traceback (most recent call last):\n", - " File \"/content/FCPGrowth.py\", line 808, in \n", - " raise WrongNumberOfArguments(\"Please Provide three arguments: iFile, minSup and minAllConf \\n\"\n", - "__main__.WrongNumberOfArguments: Please Provide three arguments: iFile, minSup and minAllConf \n", - "or Please provide four arguments: iFile, minSup, minAllConf and sep\n" - ] - } - ] - } - ] -} \ No newline at end of file From 50405bbc147e233a0d5cf7c036f17e874b535956 Mon Sep 17 00:00:00 2001 From: Lasya Date: Sat, 15 Jun 2024 12:37:30 +0530 Subject: [PATCH 06/10] adding test case to fcpgrowth --- .../basic/test_fcpgrowth.py | 811 ++++++++++++++++++ 1 file changed, 811 insertions(+) create mode 100644 tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth.py diff --git a/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth.py b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth.py new file mode 100644 index 00000000..c2fae3f2 --- /dev/null +++ b/tests/fuzzyCorrelatedPattern/basic/test_fcpgrowth.py @@ -0,0 +1,811 @@ +# FCPGrowth is the algorithm to discover Correlated Fuzzy-frequent patterns in a transactional database. +# it is based on traditional fuzzy frequent pattern mining. +# +# **Importing this algorithm into a python program** +# ------------------------------------------------------- +# +# from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg +# +# obj = alg.FCPGrowth("input.txt",2,0.4) +# +# obj.mine() +# +# correlatedFuzzyFrequentPatterns = obj.getPatterns() +# +# print("Total number of Correlated Fuzzy Frequent Patterns:", len(correlatedFuzzyFrequentPatterns)) +# +# obj.save("output") +# +# memUSS = obj.getMemoryUSS() +# +# print("Total Memory in USS:", memUSS) +# +# memRSS = obj.getMemoryRSS() +# +# print("Total Memory in RSS", memRSS) +# +# run = obj.getRuntime +# +# print("Total ExecutionTime in seconds:", run) +# + + + + + +from PAMI.fuzzyCorrelatedPattern.basic import abstract as _ab +from typing import List, Dict, Tuple, Set, Union, Any, Generator +from deprecated import deprecated + + +class _FFList: + """ + A class represent a Fuzzy List of an element + + :Attributes: + + item: int + the item name + sumIUtil: float + the sum of utilities of a fuzzy item in database + sumRUtil: float + the sum of resting values of a fuzzy item in database + elements: list + a list of elements contain tid,Utility and resting values of element in each transaction + + :Methods: + + addElement(element) + Method to add an element to this fuzzy list and update the sums at the same time. + printElement(e) + Method to print elements + + """ + + def __init__(self, itemName: str, region: str) -> None: + self.item = itemName + self.region = region + self.sumIUtil = 0.0 + self.sumRUtil = 0.0 + self.elements = [] + + def addElement(self, element: 'Element') -> None: + """ + A Method that add a new element to FFList + + :param element: an element to be added to FFList + :param element: Element + """ + + self.sumIUtil += element.IUtils + self.sumRUtil += element.RUtils + self.elements.append(element) + + +class Element: + """ + A class represents an Element of a fuzzy list + + :Attributes: + + tid : int + keep tact of transaction id + IUtils: float + the utility of a fuzzy item in the transaction + RUtil : float + the neighbourhood resting value of a fuzzy item in the transaction + """ + + def __init__(self, tid: int, IUtil: float, RUtil: float) -> None: + self.tid = tid + self.IUtils = IUtil + self.RUtils = RUtil + + +class _Regions: + """ + A class calculate the region value + + :Attributes: + + low : int + low region value + middle: int + middle region value + high : int + high region values + """ + + def __init__(self, item: str, quantity: int, regionsNumber: int, mapOfRegions: Dict) -> None: + self.low = 0 + self.middle = 0 + self.high = 0 + if regionsNumber == 3: + if 0 < quantity <= 1: + self.low = 1 + self.high = 0 + self.middle = 0 + t1 = (item, 'L') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions[t1] = temp + 1 + elif 1 <= quantity < 6: + self.low = float((-0.2 * quantity) + 1.2) + self.middle = float((0.2 * quantity) - 0.2) + self.high = 0 + t1 = (item, 'L') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions[t1] = temp + 1 + t1 = (item, 'M') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions[t1] = temp + 1 + elif 6 <= quantity <= 11: + self.low = 0 + self.middle = float((-0.2 * quantity) + 2.2) + self.high = float((0.2 * quantity) - 1.2) + t1 = (item, 'M') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions[t1] = temp + 1 + t1 = (item, 'H') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions[t1] = temp + 1 + + else: + self.low = 0 + self.middle = 0 + self.high = 1 + t1 = (item, 'H') + if t1 not in mapOfRegions.keys(): + mapOfRegions[t1] = 1 + else: + temp = mapOfRegions[t1] + mapOfRegions = temp + 1 + + +class _Pair: + + """ + A class to store item and it's quantity together + """ + + def __init__(self) -> None: + """ + A Class to Store item and its quantity together + """ + self.item = 0 + self.quantity = 0 + self.region = 'N' + +class WrongNumberOfArguments(Exception): + pass + +class FCPGrowth(_ab._corelatedFuzzyFrequentPatterns): + """ + :Description: FCPGrowth is the algorithm to discover Correlated Fuzzy-frequent patterns in a transactional database. + it is based on traditional fuzzy frequent pattern mining. + + :Reference: Lin, N.P., & Chueh, H. (2007). Fuzzy correlation rules mining. + https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.416.6053&rep=rep1&type=pdf + + :param iFile: str : + Name of the Input file to mine complete set of frequent patterns + :param oFile: str : + Name of the output file to store complete set of frequent patterns + :param minSup: int or float or str : + The user can specify minSup either in count or proportion of database size. If the program detects the data type of minSup is integer, then it treats minSup is expressed in count. Otherwise, it will be treated as float. + :param maxPer: float : + The user can specify maxPer in count or proportion of database size. If the program detects the data type of maxPer is integer, then it treats maxPer is expressed in count. + :param minAllConf: float : + The user can specify minAllConf values within the range (0, 1). + + :param sep: str : + This variable is used to distinguish items from one another in a transaction. The default seperator is tab space. However, the users can override their default separator. + + + :Attributes: + + iFile : file + Name of the input file to mine complete set of fuzzy spatial frequent patterns + oFile : file + Name of the oFile file to store complete set of fuzzy spatial frequent patterns + minSup : int + The user given support + minAllConf: float + user Specified minAllConf( should be in range 0 and 1) + memoryRSS : float + To store the total amount of RSS memory consumed by the program + startTimeTime:float + To record the startTime time of the mining process + endTime:float + To record the completion time of the mining process + itemsCnt: int + To record the number of fuzzy spatial itemSets generated + mapItemsLowSum: map + To keep track of low region values of items + mapItemsMidSum: map + To keep track of middle region values of items + mapItemsHighSum: map + To keep track of high region values of items + mapItemSum: map + To keep track of sum of Fuzzy Values of items + mapItemRegions: map + To Keep track of fuzzy regions of item + jointCnt: int + To keep track of the number of FFI-list that was constructed + BufferSize: int + represent the size of Buffer + itemBuffer list + to keep track of items in buffer + + :Methods: + + startTimeMine() + Mining process will startTime from here + getPatterns() + Complete set of patterns will be retrieved with this function + save(oFile) + Complete set of frequent patterns will be loaded in to a output file + getPatternsAsDataFrame() + Complete set of frequent patterns will be loaded in to a dataframe + getMemoryUSS() + Total amount of USS memory consumed by the mining process will be retrieved from this function + getMemoryRSS() + Total amount of RSS memory consumed by the mining process will be retrieved from this function + getRuntime() + Total amount of runtime taken by the mining process will be retrieved from this function + getRatio(self, prefix, prefixLen, item) + Method to calculate the ration of itemSet + convert(value): + To convert the given user specified value + FSFIMining( prefix, prefixLen, fsFim, minSup) + Method generate FFI from prefix + construct(px, py) + A function to construct Fuzzy itemSet from 2 fuzzy itemSets + findElementWithTID(uList, tid) + To find element with same tid as given + WriteOut(prefix, prefixLen, item, sumIUtil,ratio) + To Store the patten + + **Executing the code on terminal :** + ------------------------------------------ + + .. code-block:: console + + Format: + + (.venv) $ python3 FCPGrowth112.py + + Example Usage: + + (.venv) $ python3 FCPGrowth112.py sampleTDB.txt output.txt 2 0.2 + + .. note:: minSup will be considered in percentage of database transactions + + + **Sample run of importing the code:** + ----------------------------------------- + .. code-block:: python + + from PAMI.fuzzyCorrelatedPattern.basic import FCPGrowth as alg + + obj = alg.FCPGrowth("input.txt",2,0.4) + + obj.mine() + + correlatedFuzzyFrequentPatterns = obj.getPatterns() + + print("Total number of Correlated Fuzzy Frequent Patterns:", len(correlatedFuzzyFrequentPatterns)) + + obj.save("output") + + memUSS = obj.getMemoryUSS() + + print("Total Memory in USS:", memUSS) + + memRSS = obj.getMemoryRSS() + + print("Total Memory in RSS", memRSS) + + run = obj.getRuntime + + print("Total ExecutionTime in seconds:", run) + + **Credits:** + ------------------- + + The complete program was written by B.Sai Chitra under the supervision of Professor Rage Uday Kiran. + + """ + _startTime = float() + _endTime = float() + _minSup = str() + _maxPer = float() + _finalPatterns = {} + _iFile = " " + _oFile = " " + _minAllConf = 0.0 + _sep = " " + _memoryUSS = float() + _memoryRSS = float() + _Database = [] + + def __init__(self, iFile: str, minSup: int, minAllConf: float, sep: str="\t") -> None: + super().__init__(iFile, minSup, minAllConf, sep) + self._temp = {} + self._mapItemRegionSum = {} + self._itemsCnt = 0 + self._mapItemsLowSum = {} + self._mapItemsMidSum = {} + self._mapItemsHighSum = {} + self._mapItemSum = {} + self._mapItemRegions = {} + self._joinsCnt = 0 + self._BufferSize = 200 + self._itemSetBuffer = [] + self._finalPatterns = {} + self._dbLen = 0 + self._transactions = [] + self._fuzzyValues = [] + + def _compareItems(self, o1: _FFList, o2: _FFList) -> int: + """ + A Function that sort all FFI-list in ascending order of Support + + :param o1: First FFI-list + + :type o1: _FFList + + :param o2: Second FFI-list + + :type o1: _FFList + + :return: Comparision Value + + :rtype: int + """ + compare = self._mapItemSum[o1.item] - self._mapItemSum[o2.item] + if compare == 0: + # return int(o1.item) - int(o2.item) + return 1 + else: + return compare + + def _findElementWithTID(self, uList: _FFList, tid: int) -> Element: + """ + To find element with same tid as given + + :param uList: fuzzyList + :type uList: FFI-List + :param tid: transaction id + :type tid: int + :return: element eith tid as given + :rtype: element if exists or None + """ + List = uList.elements + first = 0 + last = len(List) - 1 + while first <= last: + mid = (first + last) >> 1 + if List[mid].tid < tid: + first = mid + 1 + elif List[mid].tid > tid: + last = mid - 1 + else: + return List[mid] + return None + + def _convert(self, value: Union[int, float, str]) -> float: + """ + To convert the given user specified value + + :param value: user specified value + + :return: converted value + + :rtype: float + """ + if type(value) is int: + value = int(value) + if type(value) is float: + value = (len(self._transactions) * value) + if type(value) is str: + if '.' in value: + value = float(value) + value = (len(self._transactions) * value) + else: + value = int(value) + return value + + def _creatingItemSets(self) -> None: + """ + Storing the complete transactions of the database/input file in a database variable + + :return: None + """ + self._transactions, self._fuzzyValues = [], [] + if isinstance(self._iFile, _ab._pd.DataFrame): + if self._iFile.empty: + print("its empty..") + i = self._iFile.columns.values.tolist() + if 'Transactions' in i: + self._transactions = self._iFile['Transactions'].tolist() + if 'fuzzyValues' in i: + self._fuzzyValues = self._iFile['Utilities'].tolist() + # print(self.Database) + if isinstance(self._iFile, str): + if _ab._validators.url(self._iFile): + data = _ab._urlopen(self._iFile) + for line in data: + line = line.decode("utf-8") + line = line.split("\n")[0] + parts = line.split(":") + parts[0] = parts[0].strip() + parts[1] = parts[1].strip() + items = parts[0].split(self._sep) + quantities = parts[1].split(self._sep) + self._transactions.append([x for x in items]) + self._fuzzyValues.append([x for x in quantities]) + else: + try: + with open(self._iFile, 'r', encoding='utf-8') as f: + for line in f: + line = line.split("\n")[0] + parts = line.split(":") + items = parts[0].split() + quantities = parts[1].split() + self._transactions.append([x for x in items]) + self._fuzzyValues.append([x for x in quantities]) + except IOError: + print("File Not Found") + quit() + + @deprecated("It is recommended to use 'mine()' instead of 'startMine()' for mining process. Starting from January 2025, 'startMine()' will be completely terminated.") + def startMine(self) -> None: + """ + Frequent pattern mining process will startTime from here + """ + self.mine() + + + def mine(self) -> None: + """ + Frequent pattern mining process will startTime from here + """ + self._startTime = _ab._time.time() + self._creatingItemSets() + for tr in range(len(self._transactions)): + items = self._transactions[tr] + quantities = self._fuzzyValues[tr] + for i in range(0, len(items)): + item = items[i] + regions = _Regions(item, float(quantities[i]), 3, self._mapItemRegionSum) + if item in self._mapItemsLowSum.keys(): + low = self._mapItemsLowSum[item] + low += regions.low + self._mapItemsLowSum[item] = low + else: + self._mapItemsLowSum[item] = regions.low + if item in self._mapItemsMidSum.keys(): + mid = self._mapItemsMidSum[item] + mid += regions.middle + self._mapItemsMidSum[item] = mid + else: + self._mapItemsMidSum[item] = regions.middle + if item in self._mapItemsHighSum.keys(): + high = self._mapItemsHighSum[item] + high += regions.high + self._mapItemsHighSum[item] = high + else: + self._mapItemsHighSum[item] = regions.high + listOfFFIList = [] + mapItemsToFFLIST = {} + self._minSup = self._convert(self._minSup) + #minSup = self._minSup + self._minAllConf = float(self._minAllConf) + for item1 in self._mapItemsLowSum.keys(): + item = item1 + region = 'N' + low = self._mapItemsLowSum[item] + mid = self._mapItemsMidSum[item] + high = self._mapItemsHighSum[item] + if low >= mid and low >= high: + self._mapItemSum[item] = low + self._mapItemRegions[item] = "L" + region = 'L' + elif mid >= low and mid >= high: + self._mapItemSum[item] = mid + self._mapItemRegions[item] = "M" + region = 'M' + elif high >= low and high >= mid: + self._mapItemRegions[item] = "H" + region = 'H' + self._mapItemSum[item] = high + if self._mapItemSum[item] >= self._minSup: + fuList = _FFList(item, region) + mapItemsToFFLIST[item] = fuList + listOfFFIList.append(fuList) + listOfFFIList.sort(key=_ab._functools.cmp_to_key(self._compareItems)) + tid = 0 + for tr in range(len(self._transactions)): + items = self._transactions[tr] + quantities = self._fuzzyValues[tr] + revisedTransaction = [] + for i in range(0, len(items)): + pair = _Pair() + pair.item = items[i] + regions = _Regions(pair.item, float(quantities[i]), 3, self._temp) + item = pair.item + if self._mapItemSum[item] >= self._minSup: + if self._mapItemRegions[pair.item] == "L": + pair.quantity = regions.low + pair.region = 'L' + elif self._mapItemRegions[pair.item] == "M": + pair.region = 'M' + pair.quantity = regions.middle + elif self._mapItemRegions[pair.item] == "H": + pair.quantity = regions.high + pair.region = 'H' + if pair.quantity > 0: + revisedTransaction.append(pair) + revisedTransaction.sort(key=_ab._functools.cmp_to_key(self._compareItems)) + for i in range(len(revisedTransaction) - 1, -1, -1): + pair = revisedTransaction[i] + remainUtil = 0 + for j in range(len(revisedTransaction) - 1, i - 1, -1): + remainUtil += revisedTransaction[j].quantity + if pair.quantity > remainUtil: + remainingUtility = pair.quantity + else: + remainingUtility = remainUtil + if mapItemsToFFLIST.get(pair.item) is not None: + FFListOfItem = mapItemsToFFLIST[pair.item] + element = Element(tid, pair.quantity, remainingUtility) + FFListOfItem.addElement(element) + tid += 1 + self._FSFIMining(self._itemSetBuffer, 0, listOfFFIList, self._minSup) + self._endTime = _ab._time.time() + process = _ab._psutil.Process(_ab._os.getpid()) + self._memoryUSS = float() + self._memoryRSS = float() + self._memoryUSS = process.memory_full_info().uss + self._memoryRSS = process.memory_info().rss + print("Fuzzy Correlated Patterns Successfully generated using FCPGrowth algorithms") + + def _FSFIMining(self, prefix: List[_FFList], prefixLen: int, FSFIM: List[_FFList], minSup: float) -> None: + """ + Generates FFSI from prefix + + :param prefix: the prefix patterns of FFSI + :type prefix: len + :param prefixLen: the length of prefix + :type prefixLen: int + :param FSFIM: the Fuzzy list of prefix itemSets + :type FSFIM: list + :param minSup: the minimum support of + :type minSup:int + """ + for i in range(0, len(FSFIM)): + X = FSFIM[i] + if X.sumIUtil >= minSup: + ratio = self._getRatio(prefix, prefixLen, X) + if ratio >= self._minAllConf: + self._WriteOut(prefix, prefixLen, X, ratio) + if X.sumRUtil >= minSup: + exULs = [] + for j in range(i + 1, len(FSFIM)): + Y = FSFIM[j] + exULs.append(self._construct(X, Y)) + self._joinsCnt += 1 + self._itemSetBuffer.insert(prefixLen, X) + self._FSFIMining(self._itemSetBuffer, prefixLen + 1, exULs, minSup) + + def _construct(self, px: _FFList, py: _FFList) -> _FFList: + """ + A function to construct a new Fuzzy itemSet from 2 fuzzy itemSets + + :param px:the itemSet px + :type px:FFI-List + :param py:itemSet py + :type py:FFI-List + :return :the itemSet of pxy(px and py) + :rtype :FFI-List + """ + pxyUL = _FFList(py.item, py.region) + for ex in px.elements: + ey = self._findElementWithTID(py, ex.tid) + if ey is None: + continue + eXY = Element(ex.tid, min([ex.IUtils, ey.IUtils], key=lambda x: float(x)), ey.RUtils) + pxyUL.addElement(eXY) + return pxyUL + + def getMemoryUSS(self) -> float: + """ + Total amount of USS memory consumed by the mining process will be retrieved from this function + + :return: returning USS memory consumed by the mining process + :rtype: float + """ + return self._memoryUSS + + def getMemoryRSS(self) -> float: + """ + Total amount of RSS memory consumed by the mining process will be retrieved from this function + + :return: returning RSS memory consumed by the mining process + :rtype: float + """ + return self._memoryRSS + + def getRuntime(self) -> float: + """ + Calculating the total amount of runtime taken by the mining process + + :return: returning total amount of runtime taken by the mining process + :rtype: float + """ + return self._endTime - self._startTime + + def _getRatio(self, prefix: List[_FFList], prefixLen: int, item: _FFList) -> float: + """ + Method to calculate the ration of itemSet + + :param prefix: prefix of itemSet + :type prefix: list + :param prefixLen: length of prefix + :type prefixLen: int + :param item: the last item + :type item: FFList + :return : correlated ratio + :rtype: float + """ + res = 1.0 + n = prefixLen + for i in prefix: + if self._mapItemRegionSum.get((i.item, i.region)) is not None and res < self._mapItemRegionSum[(i.item, i.region)]: + res = self._mapItemRegionSum[(i.item, i.region)] + if self._mapItemRegionSum.get((item.item, item.region)) is not None and res < self._mapItemRegionSum[ + (item.item, item.region)]: + res = self._mapItemRegionSum[(item.item, item.region)] + return item.sumIUtil / res + + def _WriteOut(self, prefix: List[_FFList], prefixLen: int, item: _FFList, ratio: float) -> None: + """ + To Store the patten + + :param prefix: prefix of itemSet + :type prefix: list + :param prefixLen: length of prefix + :type prefixLen: int + :param item: the last item + :type item: FFList + :param ratio: the ratio of itemSet + :type ratio: float + :return: None + """ + self._itemsCnt += 1 + res = "" + for i in range(0, prefixLen): + res += str(prefix[i].item) + "." + str(prefix[i].region) + '\t' + res += str(item.item) + "." + str(item.region) + #res1 = str(item.sumIUtil) + " : " + str(ratio) + "\n" + self._finalPatterns[res] = [item.sumIUtil, ratio] + + def getPatterns(self) -> Dict[str, List[float]]: + """ + Function to send the set of frequent patterns after completion of the mining process + + :return: returning frequent patterns + :rtype: dict + """ + return self._finalPatterns + + def getPatternsAsDataFrame(self) -> _ab._pd.DataFrame: + """ + Storing final frequent patterns in a dataframe + + :return: returning frequent patterns in a dataframe + :rtype: pd.DataFrame + """ + dataframe = {} + data = [] + for a, b in self._finalPatterns.items(): + data.append([a.replace('\t', ' '), b[0], b[1]]) + dataframe = _ab._pd.DataFrame(data, columns=['Patterns', 'Support', 'Confidence']) + return dataframe + + def save(self, outFile: str) -> None: + """ + Complete set of frequent patterns will be loaded in to an output file + + :param outFile: name of the output file + :type outFile: csv file + """ + self._oFile = outFile + writer = open(self._oFile, 'w+') + for x, y in self._finalPatterns.items(): + patternsAndSupport = x.strip() + ":" + str(y[0]) + ":" + str(y[1]) + writer.write("%s \n" % patternsAndSupport) + + def printResults(self) -> None: + """ + This function is used to print the result + """ + print("Total number of Fuzzy Correlated Patterns:", len(self.getPatterns())) + print("Total Memory in USS:", self.getMemoryUSS()) + print("Total Memory in RSS", self.getMemoryRSS()) + print("Total ExecutionTime in ms:", self.getRuntime()) + +def main(): + inputFile = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv' + + minimumSupportCount=1200 #Users can also specify this constraint between 0 to 1. + ratioExample=0.8 + seperator='\t' + + obj = FCPGrowth(inputFile, minimumSupportCount,ratioExample,seperator) #initialize + obj.mine() + + + +if __name__ == "__main__": + print("Number of arguments:", len(_ab._sys.argv)) + print("Arguments:", _ab._sys.argv) + + if len(_ab._sys.argv) == 5: + iFile = _ab._sys.argv[1] + minSup = _ab._sys.argv[2] + minAllConf = _ab._sys.argv[3] + sep = _ab._sys.argv[4] + if sep == "\\t": + sep = "\t" + + print("Input File:", iFile) + print("Minimum Support List:", minSup) + print("ratioExample:", minAllConf) + print("Separator:", sep) + + _ap = FCPGrowth(iFile=iFile, minSup=minSup, minAllConf=minAllConf, sep=sep) + _ap.mine() + + print("Total number of Frequent Patterns:", len(_ap.getPatterns())) + print("Total Memory in USS:", _ap.getMemoryUSS()) + print("Total Memory in RSS:", _ap.getMemoryRSS()) + print("Total ExecutionTime in ms:", _ap.getRuntime()) + + elif len(_ab._sys.argv) == 4: + iFile = _ab._sys.argv[1] + minSup = _ab._sys.argv[2] + minAllConf = _ab._sys.argv[3] + + print("Input File:", iFile) + print("Minimum Support List:", minSup) + print("Minimum ALL CONF:", minAllConf) + + _ap = FCPGrowth(iFile=iFile, minSup=minSup,minAllConf = minAllConf) + _ap.mine() + + print("Total number of Frequent Patterns:", len(_ap.getPatterns())) + print("Total Memory in USS:", _ap.getMemoryUSS()) + print("Total Memory in RSS:", _ap.getMemoryRSS()) + print("Total ExecutionTime in ms:", _ap.getRuntime()) + + else: + raise WrongNumberOfArguments("Please Provide three arguments: iFile, minSup and minAllConf \n" + "or Please provide four arguments: iFile, minSup, minAllConf and sep") + + From 0bfa43c42300d4063d84e73982f70d87d2b66585 Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:11:02 +0530 Subject: [PATCH 07/10] Created using Colab --- .../basic/test_ffiminer_cases.ipynb | 811 ++++++++++++++++++ 1 file changed, 811 insertions(+) create mode 100644 fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb diff --git a/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb b/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb new file mode 100644 index 00000000..badf3935 --- /dev/null +++ b/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb @@ -0,0 +1,811 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyOXjkDAEdl+97GxeGA6FB2t" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "43vYV0Xmytz6", + "outputId": "c1c042c5-c914-4469-fd24-cebb9583088d" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting pami\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from pami) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from pami) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from pami) (3.7.1)\n", + "Collecting resource (from pami)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from pami)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from pami) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from pami) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from pami) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from pami)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from pami)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m19.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from pami) (3.3)\n", + "Collecting deprecated (from pami)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->pami) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->pami) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->pami) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->pami)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->pami)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->pami)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->pami)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->pami) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->pami) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->pami) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->pami) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=2b00c240232fa499a5d018e08f3f2fa5351a6b8a973b4ff435a1c759e71e9842\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=2cdc76627f0ab8aeb5a9b123e519f2e6e400efc4cefbb1ad8013fa93d7fc3fa2\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, pami\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 deprecated-1.2.14 discord.py-2.3.2 pami-2024.6.10 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install -U pami" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for Fuzzy_T10I4D100K Dataset ##" + ], + "metadata": { + "id": "GlNw1pMMz3yx" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "X4HHpEc4z5ok" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8JPNuU2Gz8C4", + "outputId": "9bc871ae-0ed9-4b3e-c79a-b77fb6db21cc" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 21.141608 671264768\n", + "1 FFIMiner 3500 30 11.460352 660459520\n", + "2 FFIMiner 4000 19 5.538831 652382208\n", + "3 FFIMiner 4500 13 7.040772 647421952\n", + "4 FFIMiner 5000 6 6.437679 640811008\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "wmKbtU0ID6sT" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "AAGoLVG6D_WT", + "outputId": "28dbf567-9076-4848-d5b5-1debb05e7acd" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:35:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 1.95MB/s in 8.6s \n", + "\n", + "2024-06-15 16:35:11 (1.02 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "sCKI4OQZEdte", + "outputId": "a3e9a410-5e04-4baf-a775-cf0a55e8d888" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 22.260448 670347264\n", + "1 FFIMiner 3500 30 13.583152 669298688\n", + "2 FFIMiner 4000 19 2.763148 668250112\n", + "3 FFIMiner 4500 13 4.378887 668250112\n", + "4 FFIMiner 5000 6 3.255094 667201536\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "XNuMHA8zE-9P" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xNCIa_NZFBl6", + "outputId": "f2b62886-41ad-4cb9-9a7a-e7d6646c7fe2" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 23.783159 573198336\n", + "1 FFIMiner 3500 30 10.473746 566906880\n", + "2 FFIMiner 4000 19 3.105994 566906880\n", + "3 FFIMiner 4500 13 4.151447 566906880\n", + "4 FFIMiner 5000 6 3.481534 566906880\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases Retail Dataset ##" + ], + "metadata": { + "id": "_5wBaRwbosmU" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 Retail Dataset ###" + ], + "metadata": { + "id": "yITQ6s7qouCN" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "K6RntV-9oxzN", + "outputId": "66fd71c6-6a1d-4800-8ef4-a35ad62771ad" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 22 22.226274 363991040\n", + "1 FFIMiner 3500 19 22.655426 364949504\n", + "2 FFIMiner 4000 17 22.806882 364810240\n", + "3 FFIMiner 4500 15 21.607635 364208128\n", + "4 FFIMiner 5000 13 17.783820 362459136\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "3hpRI9MUrfSh", + "outputId": "8479ab55-410f-4cef-e4c1-8ba33075aff9" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:15:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 12342035 (12M) [text/csv]\n", + "Saving to: ‘Fuzzy_retail.csv’\n", + "\n", + "Fuzzy_retail.csv 100%[===================>] 11.77M 2.76MB/s in 8.6s \n", + "\n", + "2024-06-15 16:15:12 (1.36 MB/s) - ‘Fuzzy_retail.csv’ saved [12342035/12342035]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "C1U40Qxornf4", + "outputId": "4c07ec1a-b3db-45a1-e4d7-a66f6a7c9d2c" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 22 11.426563 385433600\n", + "1 FFIMiner 3500 19 10.397434 386514944\n", + "2 FFIMiner 4000 17 8.788116 386420736\n", + "3 FFIMiner 4500 15 10.458200 384520192\n", + "4 FFIMiner 5000 13 10.225325 383156224\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)\n", + "" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "YkDGIC6FspFt", + "outputId": "61686de7-df69-4e69-e303-8c7496a40dc7" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 22 12.005953 553938944\n", + "1 FCPGrowth 3500 19 9.748277 554999808\n", + "2 FCPGrowth 4000 17 11.141894 555077632\n", + "3 FCPGrowth 4500 15 10.240951 552677376\n", + "4 FCPGrowth 5000 13 9.950243 554848256\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for T20I6D100K Database ##" + ], + "metadata": { + "id": "oMbPLT4ZtItC" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for T20I6D100K Database ###" + ], + "metadata": { + "id": "0kiE7jLDtMK3" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "XFkPwiTFtO9e", + "outputId": "a0706cef-1a78-4456-909c-20778905235f" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 45.113266 674328576\n", + "1 FFIMiner 6500 30 38.239832 663670784\n", + "2 FFIMiner 7000 25 28.426486 656740352\n", + "3 FFIMiner 8500 9 17.177565 629993472\n", + "4 FFIMiner 9000 7 19.872511 626413568\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for T20I6D100K Database ###" + ], + "metadata": { + "id": "Sx3N0KZJuIhf" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "UzV17PgXuIz1", + "outputId": "cc180135-633c-49de-b3dc-1448c4a677a4" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:26:41-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 17657765 (17M) [text/csv]\n", + "Saving to: ‘Fuzzy_T20I6D100K.csv’\n", + "\n", + "Fuzzy_T20I6D100K.cs 100%[===================>] 16.84M 2.71MB/s in 13s \n", + "\n", + "2024-06-15 16:26:56 (1.29 MB/s) - ‘Fuzzy_T20I6D100K.csv’ saved [17657765/17657765]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jzjozR7xuSZT", + "outputId": "ce4ad54c-bda6-40b8-f5aa-522012aa1366" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 35.390755 674217984\n", + "1 FFIMiner 6500 30 26.388581 663859200\n", + "2 FFIMiner 7000 25 18.711585 657383424\n", + "3 FFIMiner 8500 9 6.017489 629866496\n", + "4 FFIMiner 9000 7 5.009880 644669440\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for T20I6D100K Database ###" + ], + "metadata": { + "id": "XAB-ZWQUvPWq" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)\n", + "" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "B_SaX7cmvRWW", + "outputId": "959f2200-c73a-4f7d-bf3f-6647f6e19773" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 33.357554 732360704\n", + "1 FFIMiner 6500 30 25.917757 722714624\n", + "2 FFIMiner 7000 25 20.143859 715599872\n", + "3 FFIMiner 8500 9 4.452085 694636544\n", + "4 FFIMiner 9000 7 6.969693 684691456\n" + ] + } + ] + } + ] +} \ No newline at end of file From 28f506529572e4e7aa8a145efaa7125fa755c3a8 Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:18:10 +0530 Subject: [PATCH 08/10] Delete fuzzyFrequentPattern/basic directory Accidently added to wrong path --- .../basic/test_ffiminer_cases.ipynb | 811 ------------------ 1 file changed, 811 deletions(-) delete mode 100644 fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb diff --git a/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb b/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb deleted file mode 100644 index badf3935..00000000 --- a/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb +++ /dev/null @@ -1,811 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "authorship_tag": "ABX9TyOXjkDAEdl+97GxeGA6FB2t" - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "43vYV0Xmytz6", - "outputId": "c1c042c5-c914-4469-fd24-cebb9583088d" - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Collecting pami\n", - " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from pami) (5.9.5)\n", - "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.3)\n", - "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from pami) (5.15.0)\n", - "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from pami) (3.7.1)\n", - "Collecting resource (from pami)\n", - " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", - "Collecting validators (from pami)\n", - " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.7)\n", - "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from pami) (9.4.0)\n", - "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from pami) (1.25.2)\n", - "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from pami) (5.0.2)\n", - "Collecting sphinx-rtd-theme (from pami)\n", - " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hCollecting discord.py (from pami)\n", - " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m19.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from pami) (3.3)\n", - "Collecting deprecated (from pami)\n", - " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", - "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->pami) (1.14.1)\n", - "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->pami) (3.9.5)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.2.1)\n", - "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (4.53.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.4.5)\n", - "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (24.1)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (3.1.2)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (2.8.2)\n", - "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2023.4)\n", - "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2024.1)\n", - "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->pami) (8.3.0)\n", - "Collecting JsonForm>=0.0.2 (from resource->pami)\n", - " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting JsonSir>=0.0.2 (from resource->pami)\n", - " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", - " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "Collecting python-easyconfig>=0.1.0 (from resource->pami)\n", - " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", - "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.8)\n", - "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.6)\n", - "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.1)\n", - "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.0.5)\n", - "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.1.10)\n", - "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.7)\n", - "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (3.1.4)\n", - "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.16.1)\n", - "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.18.1)\n", - "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.2.0)\n", - "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.15.0)\n", - "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.7.16)\n", - "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.4.1)\n", - "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.31.0)\n", - "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->pami)\n", - " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.3.1)\n", - "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (23.2.0)\n", - "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.4.1)\n", - "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (6.0.5)\n", - "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.9.4)\n", - "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (4.0.3)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->pami) (2.1.5)\n", - "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->pami) (4.19.2)\n", - "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->pami) (1.16.0)\n", - "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->pami) (6.0.1)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.7)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (2024.6.2)\n", - "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (2023.12.1)\n", - "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.35.1)\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.18.1)\n", - "Building wheels for collected packages: JsonForm, JsonSir\n", - " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=2b00c240232fa499a5d018e08f3f2fa5351a6b8a973b4ff435a1c759e71e9842\n", - " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", - " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=2cdc76627f0ab8aeb5a9b123e519f2e6e400efc4cefbb1ad8013fa93d7fc3fa2\n", - " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", - "Successfully built JsonForm JsonSir\n", - "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, pami\n", - "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 deprecated-1.2.14 discord.py-2.3.2 pami-2024.6.10 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" - ] - } - ], - "source": [ - "!pip install -U pami" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Test Cases for Fuzzy_T10I4D100K Dataset ##" - ], - "metadata": { - "id": "GlNw1pMMz3yx" - } - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case1 for Fuzzy_T10I4D100K Dataset ###" - ], - "metadata": { - "id": "X4HHpEc4z5ok" - } - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "# Set the input parameters\n", - "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "8JPNuU2Gz8C4", - "outputId": "9bc871ae-0ed9-4b3e-c79a-b77fb6db21cc" - }, - "execution_count": 3, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 3000 46 21.141608 671264768\n", - "1 FFIMiner 3500 30 11.460352 660459520\n", - "2 FFIMiner 4000 19 5.538831 652382208\n", - "3 FFIMiner 4500 13 7.040772 647421952\n", - "4 FFIMiner 5000 6 6.437679 640811008\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case2 for Fuzzy_T10I4D100K Dataset ###" - ], - "metadata": { - "id": "wmKbtU0ID6sT" - } - }, - { - "cell_type": "code", - "source": [ - "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "AAGoLVG6D_WT", - "outputId": "28dbf567-9076-4848-d5b5-1debb05e7acd" - }, - "execution_count": 14, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "--2024-06-15 16:35:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", - "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", - "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", - "HTTP request sent, awaiting response... 200 OK\n", - "Length: 9151461 (8.7M) [text/csv]\n", - "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", - "\n", - "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 1.95MB/s in 8.6s \n", - "\n", - "2024-06-15 16:35:11 (1.02 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_T10I4D100K.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "sCKI4OQZEdte", - "outputId": "a3e9a410-5e04-4baf-a775-cf0a55e8d888" - }, - "execution_count": 15, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 3000 46 22.260448 670347264\n", - "1 FFIMiner 3500 30 13.583152 669298688\n", - "2 FFIMiner 4000 19 2.763148 668250112\n", - "3 FFIMiner 4500 13 4.378887 668250112\n", - "4 FFIMiner 5000 6 3.255094 667201536\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case3 for Fuzzy_T10I4D100K Dataset ###" - ], - "metadata": { - "id": "XNuMHA8zE-9P" - } - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_T10I4D100K.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Read the CSV file into a DataFrame\n", - "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", - "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", - "\n", - "# Ensure all data in the \"Transaction\" column is string before splitting\n", - "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", - "\n", - "# Preprocess the dataset\n", - "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", - "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - "\n", - " # Get the patterns found\n", - " patterns = obj.getPatterns()\n", - "\n", - " # Store the results in the data frame\n", - " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "xNCIa_NZFBl6", - "outputId": "f2b62886-41ad-4cb9-9a7a-e7d6646c7fe2" - }, - "execution_count": 19, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 3000 46 23.783159 573198336\n", - "1 FFIMiner 3500 30 10.473746 566906880\n", - "2 FFIMiner 4000 19 3.105994 566906880\n", - "3 FFIMiner 4500 13 4.151447 566906880\n", - "4 FFIMiner 5000 6 3.481534 566906880\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Test Cases Retail Dataset ##" - ], - "metadata": { - "id": "_5wBaRwbosmU" - } - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case1 Retail Dataset ###" - ], - "metadata": { - "id": "yITQ6s7qouCN" - } - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "# Set the input parameters\n", - "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "K6RntV-9oxzN", - "outputId": "66fd71c6-6a1d-4800-8ef4-a35ad62771ad" - }, - "execution_count": 3, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 3000 22 22.226274 363991040\n", - "1 FFIMiner 3500 19 22.655426 364949504\n", - "2 FFIMiner 4000 17 22.806882 364810240\n", - "3 FFIMiner 4500 15 21.607635 364208128\n", - "4 FFIMiner 5000 13 17.783820 362459136\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "3hpRI9MUrfSh", - "outputId": "8479ab55-410f-4cef-e4c1-8ba33075aff9" - }, - "execution_count": 4, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "--2024-06-15 16:15:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv\n", - "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", - "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", - "HTTP request sent, awaiting response... 200 OK\n", - "Length: 12342035 (12M) [text/csv]\n", - "Saving to: ‘Fuzzy_retail.csv’\n", - "\n", - "Fuzzy_retail.csv 100%[===================>] 11.77M 2.76MB/s in 8.6s \n", - "\n", - "2024-06-15 16:15:12 (1.36 MB/s) - ‘Fuzzy_retail.csv’ saved [12342035/12342035]\n", - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_retail.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "C1U40Qxornf4", - "outputId": "4c07ec1a-b3db-45a1-e4d7-a66f6a7c9d2c" - }, - "execution_count": 6, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 3000 22 11.426563 385433600\n", - "1 FFIMiner 3500 19 10.397434 386514944\n", - "2 FFIMiner 4000 17 8.788116 386420736\n", - "3 FFIMiner 4500 15 10.458200 384520192\n", - "4 FFIMiner 5000 13 10.225325 383156224\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_retail.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", - "\n", - "# Read the CSV file into a DataFrame\n", - "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", - "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", - "\n", - "# Ensure all data in the \"Transaction\" column is string before splitting\n", - "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", - "\n", - "# Preprocess the dataset\n", - "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", - "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", - "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - "\n", - " # Get the patterns found\n", - " patterns = obj.getPatterns()\n", - "\n", - " # Store the results in the data frame\n", - " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "print(result)\n", - "" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "YkDGIC6FspFt", - "outputId": "61686de7-df69-4e69-e303-8c7496a40dc7" - }, - "execution_count": 7, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FCPGrowth 3000 22 12.005953 553938944\n", - "1 FCPGrowth 3500 19 9.748277 554999808\n", - "2 FCPGrowth 4000 17 11.141894 555077632\n", - "3 FCPGrowth 4500 15 10.240951 552677376\n", - "4 FCPGrowth 5000 13 9.950243 554848256\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Test Cases for T20I6D100K Database ##" - ], - "metadata": { - "id": "oMbPLT4ZtItC" - } - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case1 for T20I6D100K Database ###" - ], - "metadata": { - "id": "0kiE7jLDtMK3" - } - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "# Set the input parameters\n", - "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "XFkPwiTFtO9e", - "outputId": "a0706cef-1a78-4456-909c-20778905235f" - }, - "execution_count": 8, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 6000 38 45.113266 674328576\n", - "1 FFIMiner 6500 30 38.239832 663670784\n", - "2 FFIMiner 7000 25 28.426486 656740352\n", - "3 FFIMiner 8500 9 17.177565 629993472\n", - "4 FFIMiner 9000 7 19.872511 626413568\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case2 for T20I6D100K Database ###" - ], - "metadata": { - "id": "Sx3N0KZJuIhf" - } - }, - { - "cell_type": "code", - "source": [ - "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "UzV17PgXuIz1", - "outputId": "cc180135-633c-49de-b3dc-1448c4a677a4" - }, - "execution_count": 9, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "--2024-06-15 16:26:41-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv\n", - "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", - "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", - "HTTP request sent, awaiting response... 200 OK\n", - "Length: 17657765 (17M) [text/csv]\n", - "Saving to: ‘Fuzzy_T20I6D100K.csv’\n", - "\n", - "Fuzzy_T20I6D100K.cs 100%[===================>] 16.84M 2.71MB/s in 13s \n", - "\n", - "2024-06-15 16:26:56 (1.29 MB/s) - ‘Fuzzy_T20I6D100K.csv’ saved [17657765/17657765]\n", - "\n" - ] - } - ] - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_T20I6D100K.csv'\n", - "separator = '\\t'\n", - "minAllConf=0.8\n", - "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - " # Store the results in the data frame\n", - " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "\n", - "print(result)" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "jzjozR7xuSZT", - "outputId": "ce4ad54c-bda6-40b8-f5aa-522012aa1366" - }, - "execution_count": 11, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 6000 38 35.390755 674217984\n", - "1 FFIMiner 6500 30 26.388581 663859200\n", - "2 FFIMiner 7000 25 18.711585 657383424\n", - "3 FFIMiner 8500 9 6.017489 629866496\n", - "4 FFIMiner 9000 7 5.009880 644669440\n" - ] - } - ] - }, - { - "cell_type": "markdown", - "source": [ - "### Test Case3 for T20I6D100K Database ###" - ], - "metadata": { - "id": "XAB-ZWQUvPWq" - } - }, - { - "cell_type": "code", - "source": [ - "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", - "import pandas as pd\n", - "\n", - "# Set the input parameters\n", - "inputFile = 'Fuzzy_T20I6D100K.csv'\n", - "separator = '\\t'\n", - "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", - "\n", - "# Read the CSV file into a DataFrame\n", - "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", - "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", - "\n", - "# Ensure all data in the \"Transaction\" column is string before splitting\n", - "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", - "\n", - "# Preprocess the dataset\n", - "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", - "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", - "\n", - "# Initialize a data frame to store the results of FFIMiner\n", - "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", - "\n", - "# Execute the algorithm at different minSup values\n", - "for minSupCount in minimumSupportCountList:\n", - " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", - " obj.mine()\n", - "\n", - " # Get the patterns found\n", - " patterns = obj.getPatterns()\n", - "\n", - " # Store the results in the data frame\n", - " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", - "\n", - "# Print the results\n", - "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", - "print(result)\n", - "" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "B_SaX7cmvRWW", - "outputId": "959f2200-c73a-4f7d-bf3f-6647f6e19773" - }, - "execution_count": 12, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "Frequent patterns were generated successfully using FFIMiner algorithm\n", - " algorithm minSup patterns runtime memory\n", - "0 FFIMiner 6000 38 33.357554 732360704\n", - "1 FFIMiner 6500 30 25.917757 722714624\n", - "2 FFIMiner 7000 25 20.143859 715599872\n", - "3 FFIMiner 8500 9 4.452085 694636544\n", - "4 FFIMiner 9000 7 6.969693 684691456\n" - ] - } - ] - } - ] -} \ No newline at end of file From ff7745cc62e80f55b0e713769865cc231f1cf86c Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:19:18 +0530 Subject: [PATCH 09/10] Created using Colab --- .../basic/test_ffiminer_cases.ipynb | 811 ++++++++++++++++++ 1 file changed, 811 insertions(+) create mode 100644 tests/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb diff --git a/tests/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb b/tests/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb new file mode 100644 index 00000000..badf3935 --- /dev/null +++ b/tests/fuzzyFrequentPattern/basic/test_ffiminer_cases.ipynb @@ -0,0 +1,811 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyOXjkDAEdl+97GxeGA6FB2t" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "43vYV0Xmytz6", + "outputId": "c1c042c5-c914-4469-fd24-cebb9583088d" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting pami\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from pami) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from pami) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from pami) (3.7.1)\n", + "Collecting resource (from pami)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from pami)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from pami) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from pami) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from pami) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from pami)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m13.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from pami)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m19.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from pami) (3.3)\n", + "Collecting deprecated (from pami)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->pami) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->pami) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->pami) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->pami)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->pami)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->pami)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->pami)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->pami) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->pami) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->pami) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->pami) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=2b00c240232fa499a5d018e08f3f2fa5351a6b8a973b4ff435a1c759e71e9842\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=2cdc76627f0ab8aeb5a9b123e519f2e6e400efc4cefbb1ad8013fa93d7fc3fa2\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, pami\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 deprecated-1.2.14 discord.py-2.3.2 pami-2024.6.10 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install -U pami" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for Fuzzy_T10I4D100K Dataset ##" + ], + "metadata": { + "id": "GlNw1pMMz3yx" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "X4HHpEc4z5ok" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8JPNuU2Gz8C4", + "outputId": "9bc871ae-0ed9-4b3e-c79a-b77fb6db21cc" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 21.141608 671264768\n", + "1 FFIMiner 3500 30 11.460352 660459520\n", + "2 FFIMiner 4000 19 5.538831 652382208\n", + "3 FFIMiner 4500 13 7.040772 647421952\n", + "4 FFIMiner 5000 6 6.437679 640811008\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "wmKbtU0ID6sT" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "AAGoLVG6D_WT", + "outputId": "28dbf567-9076-4848-d5b5-1debb05e7acd" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:35:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 1.95MB/s in 8.6s \n", + "\n", + "2024-06-15 16:35:11 (1.02 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "sCKI4OQZEdte", + "outputId": "a3e9a410-5e04-4baf-a775-cf0a55e8d888" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 22.260448 670347264\n", + "1 FFIMiner 3500 30 13.583152 669298688\n", + "2 FFIMiner 4000 19 2.763148 668250112\n", + "3 FFIMiner 4500 13 4.378887 668250112\n", + "4 FFIMiner 5000 6 3.255094 667201536\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "XNuMHA8zE-9P" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xNCIa_NZFBl6", + "outputId": "f2b62886-41ad-4cb9-9a7a-e7d6646c7fe2" + }, + "execution_count": 19, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 46 23.783159 573198336\n", + "1 FFIMiner 3500 30 10.473746 566906880\n", + "2 FFIMiner 4000 19 3.105994 566906880\n", + "3 FFIMiner 4500 13 4.151447 566906880\n", + "4 FFIMiner 5000 6 3.481534 566906880\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases Retail Dataset ##" + ], + "metadata": { + "id": "_5wBaRwbosmU" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 Retail Dataset ###" + ], + "metadata": { + "id": "yITQ6s7qouCN" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "K6RntV-9oxzN", + "outputId": "66fd71c6-6a1d-4800-8ef4-a35ad62771ad" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 22 22.226274 363991040\n", + "1 FFIMiner 3500 19 22.655426 364949504\n", + "2 FFIMiner 4000 17 22.806882 364810240\n", + "3 FFIMiner 4500 15 21.607635 364208128\n", + "4 FFIMiner 5000 13 17.783820 362459136\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "3hpRI9MUrfSh", + "outputId": "8479ab55-410f-4cef-e4c1-8ba33075aff9" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:15:01-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 12342035 (12M) [text/csv]\n", + "Saving to: ‘Fuzzy_retail.csv’\n", + "\n", + "Fuzzy_retail.csv 100%[===================>] 11.77M 2.76MB/s in 8.6s \n", + "\n", + "2024-06-15 16:15:12 (1.36 MB/s) - ‘Fuzzy_retail.csv’ saved [12342035/12342035]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "C1U40Qxornf4", + "outputId": "4c07ec1a-b3db-45a1-e4d7-a66f6a7c9d2c" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 3000 22 11.426563 385433600\n", + "1 FFIMiner 3500 19 10.397434 386514944\n", + "2 FFIMiner 4000 17 8.788116 386420736\n", + "3 FFIMiner 4500 15 10.458200 384520192\n", + "4 FFIMiner 5000 13 10.225325 383156224\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "# transactions = df[\"Transaction\"].apply(lambda x: x.split(separator)).tolist()\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)\n", + "" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "YkDGIC6FspFt", + "outputId": "61686de7-df69-4e69-e303-8c7496a40dc7" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FCPGrowth 3000 22 12.005953 553938944\n", + "1 FCPGrowth 3500 19 9.748277 554999808\n", + "2 FCPGrowth 4000 17 11.141894 555077632\n", + "3 FCPGrowth 4500 15 10.240951 552677376\n", + "4 FCPGrowth 5000 13 9.950243 554848256\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for T20I6D100K Database ##" + ], + "metadata": { + "id": "oMbPLT4ZtItC" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for T20I6D100K Database ###" + ], + "metadata": { + "id": "0kiE7jLDtMK3" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(URL, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "XFkPwiTFtO9e", + "outputId": "a0706cef-1a78-4456-909c-20778905235f" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 45.113266 674328576\n", + "1 FFIMiner 6500 30 38.239832 663670784\n", + "2 FFIMiner 7000 25 28.426486 656740352\n", + "3 FFIMiner 8500 9 17.177565 629993472\n", + "4 FFIMiner 9000 7 19.872511 626413568\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for T20I6D100K Database ###" + ], + "metadata": { + "id": "Sx3N0KZJuIhf" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "UzV17PgXuIz1", + "outputId": "cc180135-633c-49de-b3dc-1448c4a677a4" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 16:26:41-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 17657765 (17M) [text/csv]\n", + "Saving to: ‘Fuzzy_T20I6D100K.csv’\n", + "\n", + "Fuzzy_T20I6D100K.cs 100%[===================>] 16.84M 2.71MB/s in 13s \n", + "\n", + "2024-06-15 16:26:56 (1.29 MB/s) - ‘Fuzzy_T20I6D100K.csv’ saved [17657765/17657765]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minAllConf=0.8\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFIMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jzjozR7xuSZT", + "outputId": "ce4ad54c-bda6-40b8-f5aa-522012aa1366" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 35.390755 674217984\n", + "1 FFIMiner 6500 30 26.388581 663859200\n", + "2 FFIMiner 7000 25 18.711585 657383424\n", + "3 FFIMiner 8500 9 6.017489 629866496\n", + "4 FFIMiner 9000 7 5.009880 644669440\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for T20I6D100K Database ###" + ], + "metadata": { + "id": "XAB-ZWQUvPWq" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyFrequentPattern.basic import FFIMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFIMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFIMiner(inputFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFIMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFIMiner algorithm\")\n", + "print(result)\n", + "" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "B_SaX7cmvRWW", + "outputId": "959f2200-c73a-4f7d-bf3f-6647f6e19773" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFIMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFIMiner 6000 38 33.357554 732360704\n", + "1 FFIMiner 6500 30 25.917757 722714624\n", + "2 FFIMiner 7000 25 20.143859 715599872\n", + "3 FFIMiner 8500 9 4.452085 694636544\n", + "4 FFIMiner 9000 7 6.969693 684691456\n" + ] + } + ] + } + ] +} \ No newline at end of file From f4d6a8d0081d70e5865dfe6bc461f971a80ba24a Mon Sep 17 00:00:00 2001 From: LasyaPalla <167892088+LasyaPalla@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:46:06 +0530 Subject: [PATCH 10/10] Created using Colab --- .../basic/test_ffspminer_cases.ipynb | 817 ++++++++++++++++++ 1 file changed, 817 insertions(+) create mode 100644 tests/fuzzyGeoreferencedFrequentPattern/basic/test_ffspminer_cases.ipynb diff --git a/tests/fuzzyGeoreferencedFrequentPattern/basic/test_ffspminer_cases.ipynb b/tests/fuzzyGeoreferencedFrequentPattern/basic/test_ffspminer_cases.ipynb new file mode 100644 index 00000000..db6401b7 --- /dev/null +++ b/tests/fuzzyGeoreferencedFrequentPattern/basic/test_ffspminer_cases.ipynb @@ -0,0 +1,817 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyP4STLAx8s+eqIwJLsTEE/Y" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "43vYV0Xmytz6", + "outputId": "298ce6b9-37ed-4a36-e0ca-80cdc8086b33" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting pami\n", + " Downloading pami-2024.6.10-py3-none-any.whl (1.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m8.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from pami) (5.9.5)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.3)\n", + "Requirement already satisfied: plotly in /usr/local/lib/python3.10/dist-packages (from pami) (5.15.0)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from pami) (3.7.1)\n", + "Collecting resource (from pami)\n", + " Downloading Resource-0.2.1-py2.py3-none-any.whl (25 kB)\n", + "Collecting validators (from pami)\n", + " Downloading validators-0.28.3-py3-none-any.whl (40 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.0/40.0 kB\u001b[0m \u001b[31m2.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: urllib3 in /usr/local/lib/python3.10/dist-packages (from pami) (2.0.7)\n", + "Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from pami) (9.4.0)\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from pami) (1.25.2)\n", + "Requirement already satisfied: sphinx in /usr/local/lib/python3.10/dist-packages (from pami) (5.0.2)\n", + "Collecting sphinx-rtd-theme (from pami)\n", + " Downloading sphinx_rtd_theme-2.0.0-py2.py3-none-any.whl (2.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.8/2.8 MB\u001b[0m \u001b[31m24.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting discord.py (from pami)\n", + " Downloading discord.py-2.3.2-py3-none-any.whl (1.1 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m30.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from pami) (3.3)\n", + "Collecting deprecated (from pami)\n", + " Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", + "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated->pami) (1.14.1)\n", + "Requirement already satisfied: aiohttp<4,>=3.7.4 in /usr/local/lib/python3.10/dist-packages (from discord.py->pami) (3.9.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (4.53.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (24.1)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->pami) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2023.4)\n", + "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->pami) (2024.1)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly->pami) (8.3.0)\n", + "Collecting JsonForm>=0.0.2 (from resource->pami)\n", + " Downloading JsonForm-0.0.2.tar.gz (2.4 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting JsonSir>=0.0.2 (from resource->pami)\n", + " Downloading JsonSir-0.0.2.tar.gz (2.2 kB)\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Collecting python-easyconfig>=0.1.0 (from resource->pami)\n", + " Downloading Python_EasyConfig-0.1.7-py2.py3-none-any.whl (5.4 kB)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.8)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.6)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.0.5)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.1.10)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.0.7)\n", + "Requirement already satisfied: Jinja2>=2.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (3.1.4)\n", + "Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.16.1)\n", + "Requirement already satisfied: docutils<0.19,>=0.14 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.18.1)\n", + "Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.2.0)\n", + "Requirement already satisfied: babel>=1.3 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.15.0)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (0.7.16)\n", + "Requirement already satisfied: imagesize in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (1.4.1)\n", + "Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.10/dist-packages (from sphinx->pami) (2.31.0)\n", + "Collecting sphinxcontrib-jquery<5,>=4 (from sphinx-rtd-theme->pami)\n", + " Downloading sphinxcontrib_jquery-4.1-py2.py3-none-any.whl (121 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.1/121.1 kB\u001b[0m \u001b[31m10.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4,>=3.7.4->discord.py->pami) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=2.3->sphinx->pami) (2.1.5)\n", + "Requirement already satisfied: jsonschema in /usr/local/lib/python3.10/dist-packages (from JsonForm>=0.0.2->resource->pami) (4.19.2)\n", + "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->pami) (1.16.0)\n", + "Requirement already satisfied: PyYAML in /usr/local/lib/python3.10/dist-packages (from python-easyconfig>=0.1.0->resource->pami) (6.0.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (3.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.5.0->sphinx->pami) (2024.6.2)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (2023.12.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema->JsonForm>=0.0.2->resource->pami) (0.18.1)\n", + "Building wheels for collected packages: JsonForm, JsonSir\n", + " Building wheel for JsonForm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonForm: filename=JsonForm-0.0.2-py3-none-any.whl size=3314 sha256=8166d098c671f7a760a114b70ebec950da0c7a2d54ece16309340d07e9f3e034\n", + " Stored in directory: /root/.cache/pip/wheels/b6/e5/87/11026246d3bd4ad67c0615682d2d6748bbd9a40ac0490882bd\n", + " Building wheel for JsonSir (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for JsonSir: filename=JsonSir-0.0.2-py3-none-any.whl size=4752 sha256=adfe0220b5135845f51ac3c61274ed9cfc42a32cd9c75d3ccb37b766025cd2e8\n", + " Stored in directory: /root/.cache/pip/wheels/1d/4c/d3/4d9757425983b43eb709be1043d82cd03fb863ce5f56f117e6\n", + "Successfully built JsonForm JsonSir\n", + "Installing collected packages: JsonSir, validators, python-easyconfig, deprecated, sphinxcontrib-jquery, discord.py, sphinx-rtd-theme, JsonForm, resource, pami\n", + "Successfully installed JsonForm-0.0.2 JsonSir-0.0.2 deprecated-1.2.14 discord.py-2.3.2 pami-2024.6.10 python-easyconfig-0.1.7 resource-0.2.1 sphinx-rtd-theme-2.0.0 sphinxcontrib-jquery-4.1 validators-0.28.3\n" + ] + } + ], + "source": [ + "!pip install -U pami" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for Fuzzy_T10I4D100K Dataset ##" + ], + "metadata": { + "id": "GlNw1pMMz3yx" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "X4HHpEc4z5ok" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(URL, neighborFile,minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8JPNuU2Gz8C4", + "outputId": "a2c47826-7290-460a-d85e-aca0e9e5ee78" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 46 10.764359 349032448\n", + "1 FFSPMiner 3500 30 8.164770 340406272\n", + "2 FFSPMiner 4000 19 9.637766 333725696\n", + "3 FFSPMiner 4500 13 9.509286 329670656\n", + "4 FFSPMiner 5000 6 10.226406 323334144\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "wmKbtU0ID6sT" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "AAGoLVG6D_WT", + "outputId": "76c9968c-d696-430e-9337-d22bed5b836b" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 17:01:52-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T10I4D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 9151461 (8.7M) [text/csv]\n", + "Saving to: ‘Fuzzy_T10I4D100K.csv’\n", + "\n", + "Fuzzy_T10I4D100K.cs 100%[===================>] 8.73M 1.70MB/s in 6.7s \n", + "\n", + "2024-06-15 17:02:00 (1.30 MB/s) - ‘Fuzzy_T10I4D100K.csv’ saved [9151461/9151461]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile,neighborFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "sCKI4OQZEdte", + "outputId": "472b7894-56f6-45ad-8ba1-946e6b0be0f2" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 46 3.281769 351481856\n", + "1 FFSPMiner 3500 30 2.725261 342302720\n", + "2 FFSPMiner 4000 19 3.905959 335294464\n", + "3 FFSPMiner 4500 13 2.527397 330682368\n", + "4 FFSPMiner 5000 6 2.459370 324571136\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for Fuzzy_T10I4D100K Dataset ###" + ], + "metadata": { + "id": "XNuMHA8zE-9P" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T10I4D100K.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile,neighborFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFSPMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xNCIa_NZFBl6", + "outputId": "1ce55446-9be0-4f8f-9b4c-07152ec62fb3" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 46 3.458493 475705344\n", + "1 FFSPMiner 3500 30 2.715464 466710528\n", + "2 FFSPMiner 4000 19 4.091982 459526144\n", + "3 FFSPMiner 4500 13 2.585832 481140736\n", + "4 FFSPMiner 5000 6 2.566938 449011712\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases Retail Dataset ##" + ], + "metadata": { + "id": "_5wBaRwbosmU" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 Retail Dataset ###" + ], + "metadata": { + "id": "yITQ6s7qouCN" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv'\n", + "separator = '\\t'\n", + "neighborFile='t10_neighbours.txt'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(URL,neighborFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "K6RntV-9oxzN", + "outputId": "d86faca0-f080-44bb-c4b8-ca6ac48aec8d" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 10 12.173761 494854144\n", + "1 FFSPMiner 3500 10 11.734481 495099904\n", + "2 FFSPMiner 4000 10 11.742410 495280128\n", + "3 FFSPMiner 4500 9 11.574620 493387776\n", + "4 FFSPMiner 5000 9 10.298450 493387776\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "3hpRI9MUrfSh", + "outputId": "caf98dac-1dc7-4235-dd9d-9675d9a2f426" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 17:09:02-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_retail.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.31.244.160, 150.95.161.176\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.31.244.160|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 12342035 (12M) [text/csv]\n", + "Saving to: ‘Fuzzy_retail.csv’\n", + "\n", + "Fuzzy_retail.csv 100%[===================>] 11.77M 2.11MB/s in 7.7s \n", + "\n", + "2024-06-15 17:09:11 (1.53 MB/s) - ‘Fuzzy_retail.csv’ saved [12342035/12342035]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile, neighborFile,minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "C1U40Qxornf4", + "outputId": "c9c60bd2-d524-4893-d611-5d8926cf4155" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 10 6.246262 495517696\n", + "1 FFSPMiner 3500 10 3.907621 495628288\n", + "2 FFSPMiner 4000 10 4.312675 495935488\n", + "3 FFSPMiner 4500 9 7.557032 494444544\n", + "4 FFSPMiner 5000 9 4.058341 494473216\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_retail.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [3000,3500,4000,4500,5000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile, neighborFile,minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFSPMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "print(result)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "YkDGIC6FspFt", + "outputId": "8aa05644-7d2c-4d8f-d3e5-1b9f944688bf" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 3000 10 4.460101 546082816\n", + "1 FFSPMiner 3500 10 4.182145 546574336\n", + "2 FFSPMiner 4000 10 4.632098 546607104\n", + "3 FFSPMiner 4500 9 4.171232 545419264\n", + "4 FFSPMiner 5000 9 3.919927 545394688\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Test Cases for T20I6D100K Database ##" + ], + "metadata": { + "id": "oMbPLT4ZtItC" + } + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case1 for T20I6D100K Database ###" + ], + "metadata": { + "id": "0kiE7jLDtMK3" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "# Set the input parameters\n", + "URL = 'https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv'\n", + "separator = '\\t'\n", + "neighborFile='t10_neighbours.txt'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(URL, neighborFile,minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "XFkPwiTFtO9e", + "outputId": "89f60d1a-c1a1-4bd2-80fa-f758e0c4b712" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 6000 38 13.974858 665665536\n", + "1 FFSPMiner 6500 30 14.086555 657072128\n", + "2 FFSPMiner 7000 25 12.634418 651468800\n", + "3 FFSPMiner 8500 9 11.500223 630611968\n", + "4 FFSPMiner 9000 7 11.871365 627380224\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case2 for T20I6D100K Database ###" + ], + "metadata": { + "id": "Sx3N0KZJuIhf" + } + }, + { + "cell_type": "code", + "source": [ + "!wget -nc https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "UzV17PgXuIz1", + "outputId": "ef5cb3f8-ab59-464b-a0b1-30f43d541546" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--2024-06-15 17:12:35-- https://u-aizu.ac.jp/~udayrage/datasets/fuzzyDatabases/Fuzzy_T20I6D100K.csv\n", + "Resolving u-aizu.ac.jp (u-aizu.ac.jp)... 150.95.161.176, 150.31.244.160\n", + "Connecting to u-aizu.ac.jp (u-aizu.ac.jp)|150.95.161.176|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 17657765 (17M) [text/csv]\n", + "Saving to: ‘Fuzzy_T20I6D100K.csv’\n", + "\n", + "Fuzzy_T20I6D100K.cs 100%[===================>] 16.84M 3.46MB/s in 6.1s \n", + "\n", + "2024-06-15 17:12:42 (2.75 MB/s) - ‘Fuzzy_T20I6D100K.csv’ saved [17657765/17657765]\n", + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile, neighborFile,minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + " # Store the results in the data frame\n", + " result.loc[result.shape[0]] = ['FFSPMiner', minSupCount, len(obj.getPatterns()), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(f\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jzjozR7xuSZT", + "outputId": "f09c0a17-c585-4fae-e746-e74a1f404f74" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 6000 38 5.651623 665493504\n", + "1 FFSPMiner 6500 30 5.001116 657256448\n", + "2 FFSPMiner 7000 25 5.939834 651771904\n", + "3 FFSPMiner 8500 9 4.232827 630444032\n", + "4 FFSPMiner 9000 7 5.457231 634490880\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Test Case3 for T20I6D100K Database ###" + ], + "metadata": { + "id": "XAB-ZWQUvPWq" + } + }, + { + "cell_type": "code", + "source": [ + "from PAMI.fuzzyGeoreferencedFrequentPattern.basic import FFSPMiner as alg\n", + "import pandas as pd\n", + "\n", + "# Set the input parameters\n", + "inputFile = 'Fuzzy_T20I6D100K.csv'\n", + "neighborFile='t10_neighbours.txt'\n", + "separator = '\\t'\n", + "minimumSupportCountList = [6000,6500,7000,8500,9000]\n", + "\n", + "# Read the CSV file into a DataFrame\n", + "df = pd.read_csv(inputFile, header=[0], sep=' ')\n", + "df = df.rename(columns={df.columns[0]: \"Transactions\"})\n", + "\n", + "# Ensure all data in the \"Transaction\" column is string before splitting\n", + "df[\"Transactions\"] = df[\"Transactions\"].astype(str)\n", + "\n", + "# Preprocess the dataset\n", + "transactions = df['Transactions'].apply(lambda x: x.split(separator))\n", + "transactions = pd.DataFrame(transactions, columns=['Transactions'])\n", + "\n", + "# Initialize a data frame to store the results of FFSPMiner\n", + "result = pd.DataFrame(columns=['algorithm', 'minSup', 'patterns', 'runtime', 'memory'])\n", + "\n", + "# Execute the algorithm at different minSup values\n", + "for minSupCount in minimumSupportCountList:\n", + " obj = alg.FFSPMiner(inputFile, neighborFile, minSup=minSupCount, sep=separator)\n", + " obj.mine()\n", + "\n", + " # Get the patterns found\n", + " patterns = obj.getPatterns()\n", + "\n", + " # Store the results in the data frame\n", + " result.loc[len(result)] = ['FFSPMiner', minSupCount, len(patterns), obj.getRuntime(), obj.getMemoryRSS()]\n", + "\n", + "# Print the results\n", + "print(\"Frequent patterns were generated successfully using FFSPMiner algorithm\")\n", + "print(result)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "B_SaX7cmvRWW", + "outputId": "b0f7318c-fcf5-49d2-f1b7-ccc2a8f11ece" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Frequent patterns were generated successfully using FFSPMiner algorithm\n", + " algorithm minSup patterns runtime memory\n", + "0 FFSPMiner 6000 38 5.556042 722960384\n", + "1 FFSPMiner 6500 30 6.784111 714489856\n", + "2 FFSPMiner 7000 25 4.839377 723640320\n", + "3 FFSPMiner 8500 9 5.250631 687800320\n", + "4 FFSPMiner 9000 7 4.440488 684765184\n" + ] + } + ] + } + ] +} \ No newline at end of file