Skip to main content

A python implementation on the FWPODS algorithm.

Reason this release was yanked:

File structure issue

Project description

FWPODS PY

github


A python implementation library based on the paper named "A sliding window-based approach for mining frequent weighted patterns over data streams

A


H. Bui, T. -A. Nguyen-Hoang, B. Vo, H. Nguyen and T. Le, "A Sliding Window-Based Approach for Mining Frequent Weighted Patterns Over Data Streams," in IEEE Access, vol. 9, pp. 56318-56329, 2021, doi: 10.1109/ACCESS.2021.3070132. keywords: {Data mining;Data models;Databases;Urban areas;Itemsets;Mathematical model;Information technology;Pattern mining;data streams;frequent weighted patterns;sliding window model},

Example usage

Using the existing window manager to add a transaction to the window and start the mining process

from random import randint

from collections import OrderedDict

from fwpods_py.classes import *



FWPs = []

runtimes = []

item_weights = {}



window_size = 45000

min_ws = 0.8

panel_size = 1

twm = weights_manager()



transactions = OrderedDict()

count = 0

# This sample dataset can be found on the SPMF website at https://www.philippe-fournier-viger.com/spmf/index.php?link=datasets.php

ds_name = "retail"

with open(f"./datasets/{ds_name}.txt", "r") as f:

    t_id = "1"

    for line in f:

        if count == window_size + 50:

            break

        transactions[t_id] = line.strip().split()

        for item in line.strip().split():

            if item in item_weights:

                continue

            else:

                item_weights[item] = randint(1, 10)

        t_id = str(int(t_id) + 1)

        count += 1



win_man = window_manager(None, window_size, panel_size, min_ws)

win_man.new_weights(item_weights)



# Simulate a data stream

for t_id, t_items in transactions.items():

    win_man.add_transaction(t_id, t_items)



res_location = f"./results/{ds_name}/"

with open(f"{ds_name}_runtime_total.txt", "w") as f:

    for ttr in win_man.total_runtime:

        f.write(f"{ttr.total_seconds()}\n")



with open(f"{ds_name}_runtime_algo.txt", "w") as f:

    for art in win_man.algo_runtime:

        f.write(f"{art.total_seconds()}\n")



with open(f"{ds_name}_runtime_tree.txt", "w") as f:

    for tr in win_man.tree_build_time:

        f.write(f"{tr.total_seconds()}\n")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fwpods_py-0.0.1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fwpods_py-0.0.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file fwpods_py-0.0.1.tar.gz.

File metadata

  • Download URL: fwpods_py-0.0.1.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fwpods_py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3710faf6567da43f60bfd21ab456e035326ace71039c1d4aeac84be9c85adc3a
MD5 bc44105b602cc093411eec7970193ab7
BLAKE2b-256 916a5268131739505478c9bcf21c4677ad69bd61ec0656465bf6c91a10b986d9

See more details on using hashes here.

File details

Details for the file fwpods_py-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: fwpods_py-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fwpods_py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a82e4651770373c6c6bbc8a305fea913d4b5f9f96e2b7ce398e894aaeafe0b52
MD5 ce778faa38b99674b93c791b4cdf4b3f
BLAKE2b-256 06d8e536d9a4243814839c9662236a73213410b3d1f7eac8211a70eb4ad00602

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page