1.    Pattern Mining

We learnt about Association rule and pattern mining. Refer to slides/lecture notes given in class and algorithm details in [Liu, 2007]. In this project we will be implementing a pattern mining algorithm based on the Apriori Algorithm (Figure 2.2, 2.3 in [Liu, 2007]).

2.    Dataset

You are required to find frequent patterns in this dataset.

Pre-processing: For pattern mining, one usually requires frequent itemset candidate generation and that is done based on the total ordering of elements of prevDsets as follows:

A2A10ZSC2RH4RG (629) A25HBO5V8S8SEA (159) AT6CZDCP4TRGA (87) A2CL818RN52NWN (81) A2B7BUH8834Y6M (147) A2AEZQ3DGBBLPR (91) A2ZM9BGE3K3SY2 (92) A231WM2Z2JL0U3 (209) A5JLAU2ARJ0BO (323)
. Make sure to provide a README file with your implementation which details on how to run your code with the specified inputs. You are also required to make sure that your results are generated in the same format as the examples provided in the project codebase. More specifically, your code should take command line arguments as follows:

$> project_executable min_sup k input_transaction_file_path output_file_path

Also you should NOT print the results in console. The output should be present in a flat text (using the filename given in the output_file_path parameter) bearing the structure: each line is a frequent item-set delimited by space with the support count in brackets.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import sys

# Apriori Algorithm Implementation
def apriori(data, support, kmin):
    keys = []
    locations = {}
    for i in range(len(data)):
       items = data[i]
       for item in items:
            item = tuple([item])
            if item not in locations:
                locations[item] = set([i])
    candidates = [x for x in locations.keys() if len(locations[x]) >= support]
    k1_candidates = candidates[::]
    k = 1
    while len(candidates) > 0:
       #print("Evaluating k = " + str(k) + ": " + str(len(candidates)) + " candidates\n")
       new_locations = {}
       while len(candidates) > 0:
            #if len(candidates) % 100 == 0:...

By purchasing this solution you'll be able to access the following files: and SolutionReadme.txt.

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats