pyFTSex/tutorial/pyFTS/Partitioners.ipynb

583 lines
1.0 MiB
Plaintext
Raw Normal View History

2024-08-15 12:15:32 +04:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/PYFTS/notebooks/blob/master/Partitioners.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "ZlQnXBu9ctrW"
},
"source": [
"# Exploring the Universe of Discourse Partitioners"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "thnWEpjBctrb"
},
"source": [
"## Environment Setup"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "tUF7TEtictre"
},
"source": [
"### Library install/update"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 211
},
"colab_type": "code",
"id": "8tGJbEpactrh",
"outputId": "40a187e4-1030-4a2e-9d0d-d3e755ce595c"
},
"outputs": [],
"source": [
"# !pip install -U --force-reinstall --no-deps -e git+https://git.athene.tech/sam/pyFTS.git#egg=pyFTS"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Q3BI8Ztzctrq"
},
"source": [
"### External libraries import"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "fVffyFL2ctrs",
"outputId": "e3cd497a-3845-4db9-eadb-2677897309e7"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"%pylab is deprecated, use %matplotlib inline and import the required libraries.\n",
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')\n",
"\n",
"\n",
"import matplotlib.pylab as plt\n",
"\n",
"%pylab inline\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "LCFqX2ZIctr0"
},
"source": [
"### Common pyFTS imports "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "eb5APQxcctr1"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-08-08 12:33:54.147886: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
"2024-08-08 12:33:54.168752: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
"2024-08-08 12:33:54.175031: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
"2024-08-08 12:33:54.191648: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
"To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"2024-08-08 12:33:55.150180: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n"
]
}
],
"source": [
"from pyFTS.partitioners import KMeans, Grid, FCM, Huarng, Entropy, Util as pUtil\n",
"from pyFTS.common import Membership as mf\n",
"from pyFTS.benchmarks import benchmarks as bchmk\n",
"from pyFTS.data import Enrollments"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "LFAd9ZEcctr5"
},
"source": [
"### Common data transformations"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "RB-lOHCYctr8"
},
"outputs": [],
"source": [
"from pyFTS.common import Transformations\n",
"\n",
"tdiff = Transformations.Differential(1)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "04AsyGJ3ctsB"
},
"source": [
"## Dataset"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "PYqZTrClctsE"
},
"source": [
"### Data Loading"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "zlhRQcYZctsG"
},
"outputs": [],
"source": [
"from pyFTS.data import TAIEX\n",
"\n",
"dataset = TAIEX.get_data()\n",
"dataset_diff = tdiff.apply(dataset)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "5hLqGdOactsM"
},
"source": [
"### Visualization"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 340
},
"colab_type": "code",
"id": "zTU74CmlctsM",
"outputId": "3e1b62fc-95d5-48e4-a85c-50e5c1f32ea7"
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7048949da350>]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1AAAAGsCAYAAADT1EZ6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/TGe4hAAAACXBIWXMAAA9hAAAPYQGoP6dpAADs1klEQVR4nOzdd3wT9f8H8FfSvQfQlkLZe28oSxFk6lcU/YniRnCAiigIioiAgqAoIMMFOJgOEBmFslcptEAplJYChRZKW6Aj3W2S+/2R3OXuckmTNmlG38/HgwcZl/TSJpd7fz7vz/stYxiGASGEEEIIIYSQKsltvQOEEEIIIYQQ4igogCKEEEIIIYQQE1EARQghhBBCCCEmogCKEEIIIYQQQkxEARQhhBBCCCGEmIgCKEIIIYQQQggxEQVQhBBCCCGEEGIiV1vvgC2p1WpkZmbCz88PMpnM1rtDCCGEEEIIsRGGYVBYWIjw8HDI5Ybnmep0AJWZmYmIiAhb7wYhhBBCCCHETmRkZKBx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GBksETAHiJisdczlTUmQFSCqAI4Xl1QHO927pGBNb+jjgw/vonmUwmuU3a/eLa2h1CiAWIm2OLF5hLpQgVliv1ZqoIIZYlVUXY002OjFxd5dvGQV4mP58HryHu9rf7G93WVa7/Hb9L1OLAWVEAReo8/gl/qL8Hd/mZnppUvl5NzU/fU6kZfHfgKk5e00yFX79XhAGLD+H3mJs121kHMH9XEne5e0QglozroreNmgFuPaAgihBH8UBU0lg/gJIuHGOskhchpObGrDgBAAjz98SmSX0BaNJt+
"text/plain": [
"<Figure size 1000x500 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(nrows=2, ncols=1, figsize=[10,5])\n",
"ax[0].plot(dataset)\n",
"ax[1].plot(dataset_diff)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "sFSoNXc0ctsS"
},
"source": [
"## Exploring partitioning schemes"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "G6JfThwEctsU"
},
"source": [
"### Same method with different membership functions"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 729
},
"colab_type": "code",
"id": "cQjZXjuHctsV",
"outputId": "615f3d24-7e7b-4dae-8a67-eda8e5a0f493"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAPdCAYAAABba9tpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/TGe4hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZAk+Vnfj78ys+6r73O6557ZnXtmF7why/ZXRMiWgcCY+OHgtIxsbCODMcg/ExI2wqdkY2QcQQiEBUL62iaALyH7qy/oC9ZPZk1gBIjd6Z1z5776qL67rq4zM39/ZH2yqmf6qCMrM2v384rY2NmuquxP73TV8+Tzfp73o5imaSK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kEolEIpFIJBKJRCKRSCSuI4tSEolEIpFIJBKJRCKRSCQS12m7KPUHf/AHfNu3fRvT09MoisJ//+///cDXvP7667zyyiuEw2FOnjzJ5z//+Q6OKpFIJBKJRCKRSCQSiUQieafQdlGqUChw6dIlPv3pT7f0/EePHvGt3/qtfNM3fRNzc3P82I/9GD/4gz/I7/3e77V9WIlEIpFIJBKJRCKRSCQSyTuDtotS3/zN38y//tf/mu/4ju9o6fmf+cxnOHbsGJ/61Kc4c+YMP/IjP8J3fud38nM/93N7vqZcLpPNZnf8I/EPW9sVvv+X/4Rf/9OnXh+lc0wTfucfw5d+1Ppzn/KlB1/iB3/vB9kobXh9lI4pP3jA4+/+Hgp//MdeH6VjahWdL//iNd743cdeH6Ur/uj/+q/8Pz/3b9FrV
"text/plain": [
"<Figure size 1200x1000 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"part = pUtil.explore_partitioners(dataset, 20, methods=[Grid.GridPartitioner], \n",
" mf=[mf.trimf, mf.trapmf, mf.gaussmf])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "1maVmSL5ctsa",
"outputId": "54a65ef8-897b-4f99-b9a1-79e8facb0363"
},
"outputs": [],
"source": [
"# for p in part:\n",
"# print(p)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "mtuhZt-yctsh"
},
"source": [
"### Same mathod with different membership functions and transformation"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 729
},
"colab_type": "code",
"id": "UNv9tWewctsi",
"outputId": "3582cd29-4286-4dff-a494-dd3772d6cd9f"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAPdCAYAAABba9tpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/TG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Zf8+Mc/5osvvuh3sUIIIYQQQgghhBAiOfR7UerBBx/kv/23/8aTTz7Zp8f/9re/Zdy4cfz6179m2rRp/Pmf/znPPPMM//t//+8bPsfv99Pe3n7VHyEG43BlK4/+47d8f67R6FJGlvqT8Lt74cTHRlcyolR3VvPCZy/wwdkPjC5lRAk1NXHphRdp/uPrRpcyogS8IT76x0OUfXLB6FJGlFAgwAe/+u9sf/0PRpcyoqgRlaYNJ2l59wyqqhpdzoihqiofffQRmzdvJhwOG13OiHL27P/g8JF/SzjsM7qUEeX/XKxl7aFztAVDRpciRoC4Z0rt2rWL5cuXX/W5+++/n127dt3wOb/85S/JyMiI/hk1alS8yxRJ7n98fpKjVW384tMTchGXSNt/CVX74Yu/hUjE6GpGjN8f/T0H6w/yq32/wh/2G13OiNH8x9fp2ruX+n/4B8JyMyVhjn9XTcWxZso+vkBni/zSkignv9/J2bJd7P/4PRorLxldzojhO9mM91ADnr21BC7K+0yiVFZWsn//fsrLyzlz5ozR5YwYHs9ZLlX8Xxobv6Su7iOjyxkxavwB/tfFWra3dLC+ptnocsQIEPdFqdraWvLz86/6XH5+Pu3t7Xi93us+52c/+
"text/plain": [
"<Figure size 1200x1000 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"part = pUtil.explore_partitioners(dataset, 10, methods=[Grid.GridPartitioner], \n",
" mf=[mf.trimf, mf.trapmf, mf.gaussmf], transformation=tdiff)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "ypeXTdoDctsm",
"outputId": "db0a471c-3c4c-4ccb-e50b-55ba08029fd4"
},
"outputs": [],
"source": [
"# for p in part:\n",
"# print(p)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "vu8a87vlctsr"
},
"source": [
"### Several different mathods"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m part \u001b[38;5;241m=\u001b[39m \u001b[43mpUtil\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexplore_partitioners\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdataset\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m10\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmethods\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43mHuarng\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mHuarngPartitioner\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mmf\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43mmf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtrimf\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtransformation\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtdiff\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/src/pyfts/pyFTS/partitioners/Util.py:88\u001b[0m, in \u001b[0;36mexplore_partitioners\u001b[0;34m(data, npart, methods, mf, transformation, size, save, file)\u001b[0m\n\u001b[1;32m 86\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m methods:\n\u001b[1;32m 87\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m m \u001b[38;5;129;01min\u001b[39;00m mf:\n\u001b[0;32m---> 88\u001b[0m obj \u001b[38;5;241m=\u001b[39m \u001b[43mp\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnpart\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnpart\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mm\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtransformation\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtransformation\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 89\u001b[0m obj\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m=\u001b[39m obj\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m - \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m obj\u001b[38;5;241m.\u001b[39mmembership_function\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n\u001b[1;32m 90\u001b[0m objs\u001b[38;5;241m.\u001b[39mappend(obj)\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/src/pyfts/pyFTS/partitioners/Huarng.py:17\u001b[0m, in \u001b[0;36mHuarngPartitioner.__init__\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m---> 17\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mHuarngPartitioner\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mHuarng\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/src/pyfts/pyFTS/partitioners/partitioner.py:76\u001b[0m, in \u001b[0;36mPartitioner.__init__\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 73\u001b[0m _max \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mnanmax(ndata)\n\u001b[1;32m 74\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mfloat\u001b[39m(_max \u001b[38;5;241m*\u001b[39m (\u001b[38;5;241m1\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mupper_margin) \u001b[38;5;28;01mif\u001b[39;00m _max \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m _max \u001b[38;5;241m*\u001b[39m (\u001b[38;5;241m1\u001b[39m \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mupper_margin))\n\u001b[0;32m---> 76\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msets \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuild\u001b[49m\u001b[43m(\u001b[49m\u001b[43mndata\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpartitions \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msets)\n\u001b[1;32m 80\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mordered_sets \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msetnames \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/src/pyfts/pyFTS/partitioners/Huarng.py:40\u001b[0m, in \u001b[0;36mHuarngPartitioner.build\u001b[0;34m(self, data)\u001b[0m\n\u001b[1;32m 38\u001b[0m npart \u001b[38;5;241m=\u001b[39m math\u001b[38;5;241m.\u001b[39mceil(dlen \u001b[38;5;241m/\u001b[39m base)\n\u001b[1;32m 39\u001b[0m partition \u001b[38;5;241m=\u001b[39m math\u001b[38;5;241m.\u001b[39mceil(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmin)\n\u001b[0;32m---> 40\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m c \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28;43mrange\u001b[39;49m(npart):\n\u001b[1;32m 41\u001b[0m _name \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_name(c)\n\u001b[1;32m 42\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembership_function \u001b[38;5;241m==\u001b[39m Membership\u001b[38;5;241m.\u001b[39mtrimf:\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/src/pyfts/pyFTS/partitioners/Huarng.py:40\u001b[0m, in \u001b[0;36mHuarngPartitioner.build\u001b[0;34m(self, data)\u001b[0m\n\u001b[1;32m 38\u001b[0m npart \u001b[38;5;241m=\u001b[39m math\u001b[38;5;241m.\u001b[39mceil(dlen \u001b[38;5;241m/\u001b[39m base)\n\u001b[1;32m 39\u001b[0m partition \u001b[38;5;241m=\u001b[39m math\u001b[38;5;241m.\u001b[39mceil(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmin)\n\u001b[0;32m---> 40\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m c \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28;43mrange\u001b[39;49m(npart):\n\u001b[1;32m 41\u001b[0m _name \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_name(c)\n\u001b[1;32m 42\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembership_function \u001b[38;5;241m==\u001b[39m Membership\u001b[38;5;241m.\u001b[39mtrimf:\n",
"File \u001b[0;32m_pydevd_bundle/pydevd_cython.pyx:1457\u001b[0m, in \u001b[0;36m_pydevd_bundle.pydevd_cython.SafeCallWrapper.__call__\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32m_pydevd_bundle/pydevd_cython.pyx:701\u001b[0m, in \u001b[0;36m_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32m_pydevd_bundle/pydevd_cython.pyx:1395\u001b[0m, in \u001b[0;36m_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32m_pydevd_bundle/pydevd_cython.pyx:1344\u001b[0m, in \u001b[0;36m_pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32m_pydevd_bundle/pydevd_cython.pyx:312\u001b[0m, in \u001b[0;36m_pydevd_bundle.pydevd_cython.PyDBFrame.do_wait_suspend\u001b[0;34m()\u001b[0m\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py:2070\u001b[0m, in \u001b[0;36mPyDB.do_wait_suspend\u001b[0;34m(self, thread, frame, event, arg, exception_type)\u001b[0m\n\u001b[1;32m 2067\u001b[0m from_this_thread\u001b[38;5;241m.\u001b[39mappend(frame_custom_thread_id)\n\u001b[1;32m 2069\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_threads_suspended_single_notification\u001b[38;5;241m.\u001b[39mnotify_thread_suspended(thread_id, thread, stop_reason):\n\u001b[0;32m-> 2070\u001b[0m keep_suspended \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_do_wait_suspend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mthread\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mframe\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mevent\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msuspend_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrom_this_thread\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mframes_tracker\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2072\u001b[0m frames_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 2074\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m keep_suspended:\n\u001b[1;32m 2075\u001b[0m \u001b[38;5;66;03m# This means that we should pause again after a set next statement.\u001b[39;00m\n",
"File \u001b[0;32m~/Projects/Disser/pyFTSex/.venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py:2106\u001b[0m, in \u001b[0;36mPyDB._do_wait_suspend\u001b[0;34m(self, thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)\u001b[0m\n\u001b[1;32m 2103\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_call_input_hook()\n\u001b[1;32m 2105\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprocess_internal_commands()\n\u001b[0;32m-> 2106\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(\u001b[38;5;241m0.01\u001b[39m)\n\u001b[1;32m 2108\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcancel_async_evaluation(get_current_thread_id(thread), \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28mid\u001b[39m(frame)))\n\u001b[1;32m 2110\u001b[0m \u001b[38;5;66;03m# process any stepping instructions\u001b[39;00m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"# part = pUtil.explore_partitioners(dataset, 10, methods=[Huarng.HuarngPartitioner], \n",
"# mf=[mf.trimf], transformation=tdiff)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 729
},
"colab_type": "code",
"id": "w8xYTWCsctst",
"outputId": "2f12ca83-02b1-405a-eb1f-a8f464a8db0d"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKYAAAPeCAYAAAA2yBLEAAAAOXRFWHRTb2Z0d2FyZQBNYX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25cY5sXBEEQBEEQBEEQBEEQnEST15jatm0bY8eOPeN348aNY9u2bU3dtCCcZrPLbE4txmy1qx2lbZFlyNgI5jq1k7Qpsiyzu2A31eZqtaO0OXX79mEtK1M7RptTdKKK2gqT2jHanOITmVQVF6kdo82xFNVhLalXO0abU1paSlGReL83t4aGfKqrj6kdo80pNFnYXyXu34Xm0+QdUwUFBQQHB5/xu+DgYKqqqqivP/cfVZPJRFVV1Rk/gnAlFiQd5Y6PdzLtp4NqR2lbNr0KX1wLP9ytdFIJzeK75O+4Z+U9PLr2Ueyy6IxtLpVLkzhxy61k33UXstmsdpw2I/tIKT8s2s2Pr+zG3GBVO06bcTI1mS+fe4Kvpj9JXVWl2nHaDEtRHYVv7aXwrX1YKxrUjtNmVFZW8sEHH/DBBx+IzqlmZLGUs3PXFHbuupbKyr1qx2kzam02rtmbyvg9KawtFd/DhebRInflW7RoEd7e3qd/IiIi1I4ktGKH8yr5/LcsAH7am8e29FJ1A7UVpemw6Z/K49SVcOxXdfO0EcV1xfxr778A2Fe0j59Tf1Y5Udtgq6qi8KWXADClplH6+ecqJ2obrGYbG79NAaCmzMTupCx1A7URdpuN1R+9gyzbqa+uYvPX4v3eHGRZpmJxGlhlZLONiiUZakdqM1asWIHZbMZms5GUl
"text/plain": [
"<Figure size 1200x1000 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"part = pUtil.explore_partitioners(dataset, 10, methods=[Grid.GridPartitioner, \n",
" KMeans.KMeansPartitioner, \n",
" FCM.FCMPartitioner,\n",
" Entropy.EntropyPartitioner], \n",
" mf=[mf.trimf])"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "ivkYqSlzctsz",
"outputId": "1a9161cd-ced0-4c8b-e879-b4a1134e3128"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Grid - trimf:\n",
"A0: trimf([2223.737111111111, 3126.4335, 4029.129888888889])\n",
"A1: trimf([3126.4335, 4029.129888888889, 4931.826277777778])\n",
"A2: trimf([4029.129888888889, 4931.826277777778, 5834.522666666668])\n",
"A3: trimf([4931.826277777778, 5834.522666666668, 6737.219055555557])\n",
"A4: trimf([5834.522666666668, 6737.219055555556, 7639.915444444445])\n",
"A5: trimf([6737.219055555557, 7639.915444444446, 8542.611833333334])\n",
"A6: trimf([7639.915444444445, 8542.611833333334, 9445.308222222224])\n",
"A7: trimf([8542.611833333332, 9445.308222222222, 10348.004611111111])\n",
"A8: trimf([9445.308222222222, 10348.004611111111, 11250.701000000001])\n",
"A9: trimf([10348.004611111111, 11250.701000000001, 12153.39738888889])\n",
"\n",
"KMeans - trimf:\n",
"A1: trimf([3126.434, 4446.984, 5115.59])\n",
"A2: trimf([4446.984, 5115.59, 5866.252])\n",
"A3: trimf([5115.59, 5866.252, 6468.86])\n",
"A4: trimf([5866.252, 6468.86, 7071.561])\n",
"A5: trimf([6468.86, 7071.561, 7622.299])\n",
"A6: trimf([7071.561, 7622.299, 8067.048])\n",
"A7: trimf([7622.299, 8067.048, 8537.641])\n",
"A8: trimf([8067.048, 8537.641, 9032.461])\n",
"A9: trimf([8537.641, 9032.461, 9632.606])\n",
"A10: trimf([9032.461, 9632.606, 11250.701])\n",
"\n",
"FCM - trimf:\n",
"A1: trimf([3126.434, 4889.001, 6010.956])\n",
"A2: trimf([4889.001, 6010.956, 6169.123])\n",
"A3: trimf([6010.956, 6169.123, 6397.746])\n",
"A4: trimf([6169.123, 6397.746, 6990.173])\n",
"A5: trimf([6397.746, 6990.173, 7181.347])\n",
"A6: trimf([6990.173, 7181.347, 7567.393])\n",
"A7: trimf([7181.347, 7567.393, 7818.631])\n",
"A8: trimf([7567.393, 7818.631, 8336.612])\n",
"A9: trimf([7818.631, 8336.612, 9318.522])\n",
"A10: trimf([8336.612, 9318.522, 11250.701])\n",
"\n",
"Entropy - trimf:\n",
"A0: trimf([3126.4335, 5107.275, 5918.92])\n",
"A1: trimf([5107.275, 5918.92, 6495.625])\n",
"A2: trimf([5918.92, 6495.625, 7199.905])\n",
"A3: trimf([6495.625, 7199.905, 7754.915])\n",
"A4: trimf([7199.905, 7754.915, 8233.685])\n",
"A5: trimf([7754.915, 8233.685, 8852.515])\n",
"A6: trimf([8233.685, 8852.515, 11250.701000000001])\n",
"\n"
]
}
],
"source": [
"for p in part:\n",
" print(p)"
]
}
],
"metadata": {
"colab": {
"include_colab_link": true,
"name": "Partitioners.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 0
}