Skip to main content

This is a simple module which takes input of transactions and provides it's UP-Tree, HeaderTable, and transactions dictionary

Project description

UP Tree

This is a simple module which takes input of transactions and provides it's UP-Tree, HeaderTable, and transactions along with their item-utilities. Each node N of a UP-Tree has six entries: N.item is the item name of N; N. count is the node utility of N; N.num is the support count of N; N.parent indicates the parent node of N; N.nextNode is a node link which may point to a node having the same item name as N.item; N.children which is a dictionary, it contains item name as key and Node as value of all nodes whoes parent is N. The Header table is a structure employed to facilitate the traversal of the UP-Tree. A header table entry contains an item name, an estimated utility value, and a link. The link points to the first node in the UP-Tree having the same item name as the entry. The nodes whose item names are the same can be traversed efficiently by following the links in header table and the node links in the UP-Tree.

usage:

upTree, headerTable, transanctions= UPTree(transaction File path, profit file path)

upTree.disp() # prints UP-Tree

eg:

upTree, headerTable, transactions = UPTree('D:\user\data_proj_1.txt', 'D:\user\profit1.txt')

input format:

Two text files required. One for transactions(items and quantity) and the other for profit(for each item).

eg:

format:

item1 item2 item3 item4 : quantity(item1) quantity(item2) quantity(item3) quantity(item4)

..

..

..

transaction.txt file

format:

profit(item1)

profit(item2)

profit(item3)

..

..

profit.txt file

Note: all item names should be numericals. Profit can be float or int. Profit value should be positive for all items. All quantity values should be greater than 0. All items must have a valid quantity in every transaction. All items must have profit value.

Output:

function returns

  1. upTree
  2. headertable
  3. transactions

upTree

can be printed by: upTree.disp()

profit.txt file

Each Node of UP-Tree displays following information:

headerTable

can be printed by: print(headerTable)

profit.txt file

headerTable is a dictionary. key: item, value: [transaction weighted utility, head Node of item(Node.nextNode points to other node of same item)]

transactions

can be printed by: print(transactions)

profit.txt file

transactions is a dictionary in decending order according to each item's transaction weighted utility

key: transaction number, value: dictionary(item : item utility)

Transaction Weighted Utility

definition

profit.txt file

eg for this case

profit.txt file

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

UP-Tree-0.0.1.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file UP-Tree-0.0.1.tar.gz.

File metadata

  • Download URL: UP-Tree-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4

File hashes

Hashes for UP-Tree-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3800c7b2cb5406aacaadf09074dc6e04a5bba848142c9dad93e527b616899d35
MD5 f47a0763ca6b4728f92a574bb1c07cd9
BLAKE2b-256 659053b86acdd411e5614d8aab18d893791fa93d60e5683ae9de6b0ec229bc51

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