Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CSCI/CMPE 3333 Assignment 2 Instructor: Zhixiang Chen Problem: This is our second programming assignment. This assignment has three parts: ? Part 1: I ask you to write a program to implement the...

1 answer below »
CSCI/CMPE 3333 Assignment 2 Instructor: Zhixiang Chen Problem: This is our second programming assignment. This assignment has three parts: ? Part 1: I ask you to write a program to implement the classical Apriori algorithm to find the most frequent item sets and then generate association rules from these item set. The two parameters are given as follows: minsup = 30% minconf = 90% The most frequent item set shall be output and saved a text file called “mfis.txt,” and the association rules shall also be output and saved in another text file called “ar.txt.” Note: You may use any reasonable heuristic to in your implementation to improve the running time performance of the Apriori Algorithm. ? Part II: I ask you to sort the associate rules obtained from Part 1 according to confidence values, and then output the top 10 association rules with highest confidence values. These top ten association rules shall be output and saved in the third text file called “topar.txt.” ? Part III: In word file, I ask you to evaluate the top ten association rules and briefly explain whether each of these rules is meaningful or not. Save your word file as “explan.doc” or “explan.docx.” ? Data set: The data set is the 1984 Congressional Voting Record Database archived at UCI Machine Learning Repository: Congressional Voting Records Data Set Download: Data Folder, Data Set Description Abstract: 1984 United Stated Congressional Voting Records; Classify as Republican or Democrat Data Set Characteristics: Multivariate Number of Instances: 435 Area: Social Attribute Characteristics: Categorical Number of Attributes: 16 Date Donated XXXXXXXXXXAssociated Tasks: Classification Missing Values? Yes Number of Web Hits: 69495 Program Requirement: Your program shall be coded in such a streamlined way that it takes the input data file that confines with the same name given at UCI site and generates the output files aforementioned in the Problem section. Grader shall not be asked to do any intervention with the execution of your program. Programming Language: C++ or Java, but C++ is preferred. If you choose some other language, please include a “readme.txt” to explain to the grader how he may compile and run your program. Due Date: The due date will be given via Blackboard. Warning: Any submission one week after the due date will not be accepted. How to submit your work? Please upload your source program files and your word file to Blackboard.
Answered Same Day Dec 25, 2021

Solution

Robert answered on Dec 25 2021
118 Votes
CIS 321 Case Study ‘Equipment Check-Out System’
PROGRAM FOR APRIORI ALGORITHM:
import java.io.*;
import java.util.*;
** The class encapsulates an implementation of the Apriori algorithm
* to compute frequent itemsets.
*
* Datasets contains integers (>=0) separated by spaces, one transaction by line, e.g.
* 1 2 3
* 0 9
* 1 9
*
* Usage with the command line :
* $ java mining.Apriori fileName support
* $ java mining.Apriori /tmp/data.dat 0.8
* $ java mining.Apriori /tmp/data.dat 0.8 > frequent-itemsets.txt
*
* Usage as li
ary: see {@link ExampleOfClientCodeOfApriori}
*
* @author Martin Monpe
us, University of Darmstadt, 2010
* @author Nathan Magnus and Su Yibin, under the supervision of Howard Hamilton, University of Regina, June 2009.
* @copyright GNU General Public License v3
* No reproduction in whole or part without maintaining this copyright notice
* and imposing this condition on any subsequent users.
*
public class Apriori extends Observable {
public static void main(String[] args) throws Exception {
Apriori ap = new Apriori(args);
}
/** the list of cu
ent itemsets *
private List itemsets ;
/** the name of the transcation file *
private String transaFile;
/** number of different items in the dataset *
private int numItems;
/** total number of transactions in transaFile *
private int numTransactions;
/** minimum support for a frequent itemset in percentage, e.g. 0.8 *
private double minSup;
/** by default, Apriori is used with the command line interface *
private boolean usedAsLi
ary = false;
/** This is the main interface to use this class as a li
ary *
public Apriori(String[] args, Observer ob) throws Exception
{

usedAsLi
ary = true;

configure(args);

this.addObserver(ob);

go();
}
/** generates the apriori itemsets from a file
*
* @param args configuration parameters: args[0] is a filename, args[1] the min support (e.g. 0.8 for 80%)
*
public Apriori(String[] args) throws Exception
{
configure(args);
go();
}
/** starts the algorithm after configuration *
private void go() throws Exception {

start time
long start = System.cu
entTimeMillis();

first we generate the candidates of size 1
createItemsetsOfSize1();
int itemsetNumber=1;
the cu
ent itemset being looked at
int nbFrequentSets=0;
while (itemsets.size()>0)
{
calculateFrequentItemsets();
if(itemsets.size()!=0)
{
nbFrequentSets+=itemsets.size();
log("Found "+itemsets.size()+" frequent itemsets of size " + itemsetNumber + " (with support "+(minSup*100)+"%)");;
createNewItemsetsFromPreviousOnes();
}
itemsetNumber++;
}

display the execution time
long end = System.cu
entTimeMillis();
log("Execution time is: "+((double)(end-start)/1000) + " seconds.");
log("Found "+nbFrequentSets+ " frequents sets for support "+(minSup*100)+"% (absolute...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here