Skip to main content

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")

Metadata

Release files for fwpods-py 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fwpods-py 0.0.3
File Size Uploaded
fwpods_py-0.0.3.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fwpods-py 0.0.3
File Interpreter ABI Platform
fwpods_py-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / fwpods_py-0.0.3.tar.gz

Download URL fwpods_py-0.0.3.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb12875d02414057b8bfe9d4d6ab21439672803266f18e7570f83413ae3656ac
BLAKE2b-256 checksum
How to use checksums
d914d320a0b721409e2a88a8779aa6aec63cf50f37d995102c5db474ad257264
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / fwpods_py-0.0.3-py3-none-any.whl

Download URL fwpods_py-0.0.3-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6d1337806176daa1e815a41cbbf37f0b1348754ceb41076627b51e15c350df5
BLAKE2b-256 checksum
How to use checksums
c2cac3629f11b2c9d2dfd725748bd57a3c658b6613d3ffd081936e5a702e65e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page