Mining Frequent Patterns java project are the most efficient one. Its function is to mine the transactional data which describes the behaviour of the transaction. In an online business or in an online shopping the customers can purchase items together. Efficient-Algorithm-for-Mining-Frequent-Patterns-Java-Project

Frequent patterns are patterns such as item sets, sub sequences or substructures that appear in a data set frequently. Many efficient algorithms were developed based on the data structure and the processing scheme. The mining of most efficient algorithms such as Apriori and FP Growth were implemented here. 

Project Details: 

In this paper we propose the efficient algorithms (Apriori and FP Growth) used to mine the frequent patterns. Frequent patterns are patterns such as item sets, subsequences or substructures that appear in a data set frequently. From the transactional database, we can examine the behaviour of the products purchased by the customers. 

For example a set of items Mobile and SIM card that appear frequently as well as together in a transaction set is a frequent item set. Subsequences means if a customer buys a Mobile he must also buy a SIM card and then head phone etc. 

From the history of the database these transactions are happening sequentially is called sequential patterns. The Substructure refers to different structural forms such as sub graphs, sub trees which may be used along with item sets or sequences. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
import java.net.*;
import java.util.*;
import java.io.*;
import javax.swing.*;

public class Req
{

static Socket s1,s2,d;
static Vector localvect=new Vector(10);
static Vector localvecttemp=new Vector(10);
static Vector recvect=new Vector(10);
static int i=0;
static String file="";
static Vector vv=new Vector();
static String mm;
static String tte;
static Sender sen;
static String jdd;
static String dd;

public static void main(String a[]) throws Exception
{

String path="";
Enumeration it;
String sender="";
String localaddr=(InetAddress.getLocalHost()).getHostName();
String destination="";
Socket s1,s2,d;
String sockaddr="";
String next="";
int vectsize;

try
{

ServerSocket ss=new ServerSocket(8888);
new tab();
while(true)
{
System.out.println("Connected ");
tab.setTable("Connected ");

System.out.println(localaddr+" is Waiting....... ");
tab.setTable(localaddr+" is Waiting....... ");
Socket s=ss.accept();
InputStream ins=s.getInputStream();
OutputStream ous=s.getOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(ous);
ObjectInputStream ois=new ObjectInputStream(ins);
FileReader fr=new FileReader("nextnodes.txt");
BufferedReader br=new BufferedReader(fr);
String fd=(String)ois.readObject();
if(fd.equals("reqroute"))
{
System.out.println("Route Request...");
tab.setTable("Route Request...");
localvect=(Vector)ois.readObject();
sender=(String)localvect.firstElement();
System.out.println("The Sender address is : "+sender);
tab.setTable("The Sender address is : "+sender);
destination=(String)localvect.get(1);
System.out.println("The Destined address is : "+destination);
tab.setTable("The Destined address is : "+destination);
System.out.println("The Local Address is : "+localaddr);
tab.setTable("The Local Address is : "+localaddr);
if(destination.equalsIgnoreCase(localaddr))
{
req(localvect);
}
else
{
while((next=br.readLine())!=null)
{

try
{
s1=new Socket(next,8888);
OutputStream ous1=s1.getOutputStream();
ObjectOutputStream oos3=new ObjectOutputStream(ous1);
localvect.addElement(localaddr);
oos3.writeObject("reqroute");
oos3.writeObject(localvect);
}
catch(Exception e)
{
System.out.println("Error in file "+e);
tab.setTable("Error in file "+e);
}

}
}

}

else if(fd.equals("ack"))
{
Timers.rece();
System.out.println("Acknowledgement from destination ...");
tab.setTable1("Acknowledgement from destination ...");
localvect=(Vector)ois.readObject();
it=localvect.elements();
while(it.hasMoreElements())
{
path=(String)it.nextElement();
System.out.print(" "+path+" --> ");
tab.setTable1(" "+path+" --> ");
}
System.out.println();
if(((String)localvect.firstElement()).equalsIgnoreCase(localaddr))
{
i++;
System.out.println("Acknowledgement sent from the destination ....");
tab.setTable1("Acknowledgement sent from the destination ....");
System.out.println("The sender can send the data now....");
tab.setTable1("The sender can send the data now....");
String destin=(String)localvect.remove(1);
localvect.add(destin);
it=localvect.elements();
System.out.println("Source ");
tab.setTable1("Source ");
System.out.println("The path from source to destination is as follows :");
tab.setTable1("The path from source to destination is as follows :");
while(it.hasMoreElements())
{
path=(String)it.nextElement();
System.out.println(" "+path+" --> ");
tab.setTable1(" "+path+" --> ");

}
new Store_Path(i,localvect);
Store_Path.file();
System.out.println(" Destination ");
tab.setTable1(" Destination ");
Socket1();

}

else if(((String)localvect.get(2)).equalsIgnoreCase(localaddr))
{

localvect.remove(localvect.size()-1);
s2=new Socket((String)localvect.firstElement(),8888);
OutputStream os2=s2.getOutputStream();
ObjectOutputStream ous2=new ObjectOutputStream(os2);
ous2.writeObject("ack");
FileOutputStream foo=new FileOutputStream("paths.txt");
ObjectOutputStream oopp=new ObjectOutputStream(foo);
oopp.writeObject(localvect);
ous2.writeObject(localvect);
}

else

{
localvect.remove(localvect.size()-1);
sockaddr=(String)localvect.get(localvect.size()-1);
Enumeration en=localvect.elements();
System.out.println("The next system address is "+sockaddr);
tab.setTable1("The next system address is "+sockaddr);
s2=new Socket(sockaddr,8888);
System.out.println("Intermediate node "+localaddr+" forwarding the ack to "+sockaddr);
tab.setTable1("Intermediate node "+localaddr+" forwarding the ack to "+sockaddr);
OutputStream os2=s2.getOutputStream();
ObjectOutputStream ous2=new ObjectOutputStream(os2);
ous2.writeObject("ack");
ous2.writeObject(localvect);

}
}

else if(fd.equals("file++"))

{
i++;
String sub=(String)ois.readObject();
vv=(Vector)ois.readObject();
System.out.println("The String sent is "+sub);
new Store_Path(i,vv);
Store_Path.file();
Sender.Socket2(i,sub);
}
else if(fd.equals("file"))
{
JOptionPane.showMessageDialog(null,"File Received","File",JOptionPane.INFORMATION_MESSAGE);
dd=(String)ois.readObject();
System.out.println("The message sent from source is ::"+dd);
tab.setTable1("The message sent from source is ::"+dd);
Recv re=new Recv();
FileInputStream pa=new FileInputStream("paths.txt");
ObjectInputStream ooo=new ObjectInputStream(pa);
Vector n=(Vector)ooo.readObject();
for(int h=0;h<n.size();h++)
{
System.out.println("The value inside vector is "+n.get(h));
tab.setTable("The value inside vector is "+n.get(h));
}
if(n.size()==2)
{
Socket ssp=new Socket((String)n.get(0),8888);
ObjectOutputStream oop=new ObjectOutputStream(ssp.getOutputStream());
oop.writeObject("ackfile");
oop.writeObject("The message \""+dd+"\" has received by the destination "+(String)n.get(1));
}
else
{
Socket sss=new Socket((String)n.lastElement(),8888);
n.removeElementAt(n.size()-1);
ObjectOutputStream oop1=new ObjectOutputStream(sss.getOutputStream());
oop1.writeObject("ackfile1");
oop1.writeObject("The message \""+dd+"\" has received by the destinaton "+(String)n.get(1));
oop1.writeObject(n);

}

}
else if(fd.equals("ackfile"))
{
jdd=(String)ois.readObject();
System.out.println(jdd);
tab.setTable1(jdd);
}
else if(fd.equals("ackfile1"))
{
String ds=(String)ois.readObject();
Vector vl=(Vector)ois.readObject();
if(vl.size()==2)
{
Socket sspd=new Socket((String)vl.get(0),8888);
ObjectOutputStream oop=new ObjectOutputStream(sspd.getOutputStream());
oop.writeObject("ackfile");
oop.writeObject(ds);

}
else
{
Socket ssj=new Socket((String)vl.lastElement(),8888);
vl.removeElementAt(vl.size()-1);
ObjectOutputStream oop1=new ObjectOutputStream(ssj.getOutputStream());
oop1.writeObject("ackfile1");
oop1.writeObject(ds);
oop1.writeObject(vl);

}

}
}

}
catch(Exception e)
{
System.out.println("Some Error has occurred : "+e);
tab.setTable("Some Error has occurred : "+e);
}

}

public static void req(Vector v)
{
String b="";
try
{
int o=v.size();
if(o==2)
{
b=(String)v.firstElement();
}
else
{
b=(String)(v.lastElement());
}
Enumeration en=v.elements();
while(en.hasMoreElements())
{
String f=(String)en.nextElement();
System.out.println("The path from source to destination : "+f);
tab.setTable1("The path from source to destination : "+f);
}
d=new Socket(b,8888);
OutputStream os=d.getOutputStream();
ObjectOutputStream oos1=new ObjectOutputStream(os);
oos1.writeObject("ack");
String ss="";
localvect=v;
FileOutputStream foo=new FileOutputStream("paths.txt");
ObjectOutputStream oopp=new ObjectOutputStream(foo);
oopp.writeObject(localvect);
boolean boo=true;
if(o==2)
{}
else
{
for(int i=2;i<o;i++)
{
v.add((String)localvect.get(i));
}
}

oos1.writeObject(v);

}
catch(Exception e)
{
System.out.println("Error at ack sending in destination "+e);
tab.setTable1("Error at ack sending in destination "+e);
}
}

public static void Socket1()throws Exception
{
System.out.println("Inside Socket1");
FileInputStream fip=new FileInputStream("rsain.txt");
byte str[]=new byte[fip.available()];
fip.read(str,0,str.length);
String tte=new String(str);
System.out.println("The mmm is :::"+tte);
FileInputStream fis=new FileInputStream("path1.txt");
ObjectInputStream ois=new ObjectInputStream(fis);
Vector d=(Vector)ois.readObject();
int siz=d.size();
System.out.println("The size of the vector is ::"+siz);
for(int j=0;j<siz;j++)
{
System.out.print("++__++-->>"+d.get(j));

}
if(siz==2)
{

Socket soc=new Socket((String)d.get(1),8888);
ObjectOutputStream oos=new ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file");
System.out.println("The string in the textbox ::"+tte);
oos.writeObject(tte);
}
else
{
d.removeElementAt(0);
int m=d.size();
System.out.println("The size after removing the element..."+m);
Socket soc=new Socket((String)d.get(1),8888);
ObjectOutputStream oos=new ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file++");
System.out.println("The string in the textbox ::"+tte);
oos.writeObject(tte);
oos.writeObject(d);

}

}

}

Many of the algorithms were developed for mining the frequent items. In this paper we propose the efficient algorithms (Apriori and FP Growth) used to mine the frequent patterns. The Apriori algorithm generates candidate set during each pass. It reduces the dataset by discarding the infrequent item sets that do not meet the minimum threshold from the candidate sets. 

To avoid the generation of candidate set which is expensive the FP Growth algorithm is used to mine the database. The FP Growth does not generate the candidate set instead it generates an optimized data set that is FP tree from the dataset.

 The FP tree is mined to construct a conditional database. FP mining processes uses the divide and conquers strategy, so the dataset shrinks and gives us quite small conditional frequent pattern base. From this database the frequent patterns are generated. 

Conclusion: 

Traditional system based on the manual calculation and dynamic counting method. We propose the efficient algorithms used to mine the frequent patterns. We have proposed the implementation of efficient algorithms to find frequent patterns. 

The Apriori algorithm scans the dataset repeatedly whereas the FP growth avoids the costly candidate set procedure and generates the highly condensed database called as FP tree. Implementation of this project shows that the FP Growth method is efficient for mining frequent patterns and it is an order of magnitude faster than Apriori algorithm.

download Project Report  of  CSE Mining Frequent Patterns java project.