0% found this document useful (0 votes)
144 views40 pages

Data Mining Lab Manual 2024-2025

Uploaded by

lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views40 pages

Data Mining Lab Manual 2024-2025

Uploaded by

lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

lOMoARcPSD|34963378

MANNAR THIRUMALAI NAICKER COLLEGE(AUTONOMOUS)


PASUMALAI, MADURAI-625004.

DEPARTMENT OF COMPUTER APPLICATIONS

DATA MINING
LAB RECORD

Bachelor of Computer Applications


Academic year 2024-2025
III Year V Semester
Data Mining Lab

1
lOMoARcPSD|34963378

BONAFIDE CERTIFICATE
NAME :
REGISTER NUMBER :
CLASS : I I I BCA SEMESTER: V
SUBJECT WITH CODE : DATA MINING LAB

This is to certify that the record is a bonafide work done by the


above mentioned student. This certificate is awarded for the same.

MS. [Link] MS. [Link]


MCA., [Link]., MCA., [Link].,
Staff In-Charge Head of the Department

Submitted for practical examination held on ………………….. at Mannar Thirumalai


Naicker College, Pasumalai, Madurai.

INTERNAL EXAMINER EXTERNAL EXAMINER

2
lOMoARcPSD|34963378

INDEX

[Link] DATE PROGRAM LIST PAGE NO SIGNATURE

1
Create an Employee Table

Create a Weather
2
Table
Pre-Processing techniques to the
3
training data set of Weather Table
Pre-Processing techniques
4 to the training data set of
Employee Table
Association Rules for
5
Buying data.

Association Rules for


6
Banking data.

Association Rules for


7
Employee data.

Decision Tree for Weather


8
data and classify it.

Decision Tree for Customer


9 data and classify it.

Decision Tree for Location


10
data and classify it.
Employee data using Make
Density Based Cluster
11
Algorithm.

Clustering Customer data using


12 Simple KMeans Algorithm.

3
lOMoARcPSD|34963378

EXPERIMENT NO: 1

Aim:

Create an Employee Table with the help of Data Mining Tool WEKA.

Procedure:

Steps:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Employee Table.

@relation employee
4
lOMoARcPSD|34963378

@attribute name {x,y,z,a,b}


@attribute id numeric
@attribute salary {low,medium,high}
@attribute exp numeric
@attribute gender {male,female}
@attribute phone numeric

@data
x,101,low,2,male,250311
y,102,high,3,female,251665
z,103,medium,1,male,240238
a,104,low,5,female,200200
b,105,high,2,male,240240

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows employee table on weka.

5
lOMoARcPSD|34963378

Training Data Set  Weather Table

Result:

This program has been successfully executed.

6
lOMoARcPSD|34963378

EXPERIMENT NO:2

Aim:

Create a Weather Table with the help of Data Mining Tool WEKA.

Procedure:

Steps:

@relation weather
@attribute outlook
{sunny,rainy,overcast} @attribute
temparature numeric @attribute humidity
numeric
@attribute windy {true,false}
@attribute play {yes,no}

@data
sunny,85.0,85.0,false,no
overcast,80.0,90.0,true,no
sunny,83.0,86.0,false,yes
rainy,70.0,86.0,false,yes
rainy,68.0,80.0,false,yes
rainy,65.0,70.0,true,no
overcast,64.0,65.0,false,yes
sunny,72.0,95.0,true,no
sunny,69.0,70.0,false,yes
rainy,75.0,80.0,false,yes

1) Minimize the arff file and then open Start  Programs  weka-3-4.
2) Click on weka-3-4, then Weka dialog box is displayed on the screen.
3) In that dialog box there are four modes, click on explorer.
4) Explorer shows many options. In that click on ‘open file’ and select the arff file
5) Click on edit button which shows weather table on weka.

7
lOMoARcPSD|34963378

Training Data Set  Weather Table

Result:

This program has been successfully executed.

8
lOMoARcPSD|34963378

EXPERIMENT NO:3

Aim:

Apply Pre-Processing techniques to the training data set of Weather Table

Procedure:

@relation weather
@attribute outlook
{sunny,rainy,overcast} @attribute
temparature numeric @attribute humidity
numeric
@attribute windy {true,false}
@attribute play {yes,no}

@data
sunny,85.0,85.0,false,no
overcast,80.0,90.0,true,no
sunny,83.0,86.0,false,yes
rainy,70.0,86.0,false,yes
rainy,68.0,80.0,false,yes
rainy,65.0,70.0,true,no
overcast,64.0,65.0,false,yes
sunny,72.0,95.0,true,no
sunny,69.0,70.0,false,yes
rainy,75.0,80.0,false,yes
1) Minimize the arff file and then open Start  Programs  weka-3-4.
2) Click on weka-3-4, then Weka dialog box is displayed on the screen.
3) In that dialog box there are four modes, click on explorer.
4) Explorer shows many options. In that click on ‘open file’ and select the arff file
5) Click on edit button which shows weather table on weka.

9
lOMoARcPSD|34963378

10

Add  Pre-Processing Technique:

Procedure:

1) Click on Choose button and select the Filters option.


2) In Filters, we have Supervised and Unsupervised data.
3) Click on Unsupervised data.
4) Select the attribute Add.
5) A new window is opened.
6) In that we enter attribute index, type, data format, nominal label values for Climate.
7) Click on OK.
8) Press the Apply button, then a new attribute is added to the Weather Table.
9) Save the file.
10) Click on the Edit button, it shows a new Weather Table on Weka.

Weather Table after adding new attribute CLIMATE:

10
lOMoARcPSD|34963378

11

Remove  Pre-Processing Technique:

Procedure:

1) Click on Choose button and select the Filters option.


2) In Filters, we have Supervised and Unsupervised data.
3) Click on Unsupervised data.
4) Select the attribute Remove.
5) Select the attributes windy, play to Remove.
6) Click Remove button and then Save.
7) Click on the Edit button, it shows a new Weather Table on Weka.

11
lOMoARcPSD|34963378

12

Weather Table after removing attributes WINDY, PLAY:

Result:

This program has been successfully executed.

12
lOMoARcPSD|34963378

13

EXPERIMENT NO:4

Aim:

Apply Pre-Processing techniques to the training data set of Employee Table

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Employee Table.

@relation employee
@attribute name {x,y,z,a,b}
@attribute id numeric
@attribute salary {low,medium,high}
@attribute exp numeric
@attribute gender {male,female}
@attribute phone numeric

@data
x,101,low,2,male,250311
y,102,high,3,female,251665
z,103,medium,1,male,240238
a,104,low,5,female,200200
b,105,high,2,male,240240

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows employee table on weka.

13
lOMoARcPSD|34963378

14

Training Data Set  Employee Table

Add  Pre-Processing Technique:

Procedure:

1) Click on Choose button and select the Filters option.


2) In Filters, we have Supervised and Unsupervised data.
3) Click on Unsupervised data.
4) Select the attribute Add.
5) A new window is opened.
6) In that we enter attribute index, type, data format, nominal label values for Address.
7) Click on OK.
8) Press the Apply button, then a new attribute is added to the Employee Table.
9) Save the file.
10) Click on the Edit button, it shows a new Employee Table on Weka.

14
lOMoARcPSD|34963378

15

Employee Table after adding new attribute ADDRESS:

Remove  Pre-Processing Technique:

Procedure:

1) Click on Choose button and select the Filters option.


2) In Filters, we have Supervised and Unsupervised data.
3) Click on Unsupervised data.
4) Select the attribute Remove.
5) Select the attributes salary, gender to Remove.
6) Click Remove button and then Save.
7) Click on the Edit button, it shows a new Employee Table on Weka.

15
lOMoARcPSD|34963378

16

Employee Table after removing attributes SALARY, GENDER:

Result:

This program has been successfully executed.

16
lOMoARcPSD|34963378

17

EXPERIMENT NO:5

Aim: Finding Association Rules for Buying data.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Buying
Table. @relation buying
@attribute age {L20,20-40,G40}
@attribute income {high,medium,low}
@attribute stud {yes,no}
@attribute creditrate {fair,excellent}
@attribute buyscomp {yes,no}
@data
L20,high,no,fair,yes
20-
40,low,yes,fair,yes
G40,medium,yes,fair,yes
L20,low,no,fair,no
G40,high,no,excellent,yes
L20,low,yes,fair,yes
20-40,high,yes,excellent,no
G40,low,no,fair,yes
L20,high,yes,excellent,yes
G40,high,no,fair,yes
L20,low,yes,excellent,no
G40,high,yes,excellent,no
20-40,medium,yes,excellent,yes
L20,medium,yes,fair,yes
G40,high,yes,excellent,yes

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows buying table on weka.

Output:

Training Data Set  Buying Table

17
lOMoARcPSD|34963378

18

Procedure for Association Rules:

1) Select Associate option on the top of the Menu bar.


2) Select Choose button and then click on Apriori Algorithm.
3) Click on Start button and output will be displayed on the right side of the window.

18
lOMoARcPSD|34963378

19

Result:

This program has been successfully executed.

19
lOMoARcPSD|34963378

20

EXPERIMENT NO:6

Aim: Finding Association Rules for Banking data.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Banking
Table. @relation bank
@attribute cust {male,female}
@attribute accno
{0101,0102,0103,0104,0105,0106,0107,0108,0109,0110,0111,0112,0113,0114,0115}
@attribute bankname {sbi,hdfc,sbh,ab,rbi}
@attribute location {hyd,jmd,antp,pdtr,kdp}
@attribute deposit {yes,no}
@data
male,0101,sbi,hyd,yes
female,0102,hdfc,jmd,no
male,0103,sbh,antp,yes
male,0104,ab,pdtr,yes
female,0105,sbi,jmd,no
male,0106,ab,hyd,yes
female,0107,rbi,jmd,yes
female,0108,hdfc,kdp,no
male,0109,sbh,kdp,yes
male,0110,ab,jmd,no
female,0111,rbi,kdp,yes
male,0112,sbi,jmd,yes
female,0113,rbi,antp,no
male,0114,hdfc,pdtr,yes
female,0115,sbh,pdtr,no
3) After that the file is saved with .arff file format.
4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows banking table on weka.

Training Data Set  Banking Table

20
lOMoARcPSD|34963378

21

Procedure for Association Rules:

1) Select Associate option on the top of the Menu bar.


2) Select Choose button and then click on Apriori Algorithm.
3) Click on Start button and output will be displayed on the right side of the window.

21
lOMoARcPSD|34963378

22

Output:

Result:

This program has been successfully executed.

22
lOMoARcPSD|34963378

23

EXPERIMENT NO:7

Aim: Finding Association Rules for Employee data.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Employee
Table. @relation employee-1
@attribute age {youth, middle, senior}
@attribute income {high, medium, low}
@attribute class {A, B, C}

@data
youth, high, A
youth,medium,B
youth, low, C
middle, low, C
middle, medium, C
middle, high, A
senior, low, C
senior, medium, B
senior, high, B
middle, high, B

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows employee table on weka.

23
lOMoARcPSD|34963378

24

Training Data Set  Employee Table

Procedure for Association Rules:

1) Select Associate option on the top of the Menu bar.


2) Select Choose button and then click on Apriori Algorithm.
3) Click on Start button and output will be displayed on the right side of the window.

24
lOMoARcPSD|34963378

25

Output:

Result:

This program has been successfully executed.

25
lOMoARcPSD|34963378

26

EXPERIMENT NO:8

Aim:

To Construct Decision Tree for Weather data and classify it.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Weather
Table. @relation weather
@attribute outlook {sunny, rainy, overcast}
@attribute temperature numeric
@attribute humidity numeric
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}

@data
sunny,85,85,FALSE,no
sunny,80,90,TRUE,no
overcast,83,86,FALSE,yes
rainy,70,96,FALSE,yes
rainy,68,80,FALSE,yes
rainy,65,70,TRUE,no
overcast,64,65,TRUE,yes
sunny,72,95,FALSE,no
sunny,69,70,FALSE,yes
rainy,75,80,FALSE,yes
sunny,75,70,TRUE,yes
overcast,72,90,TRUE,yes
overcast,81,75,FALSE,yes
rainy,71,91,TRUE,no

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.

26
lOMoARcPSD|34963378

27

5) Click on weka-3-4, then Weka dialog box is displayed on the screen.


6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows weather table on weka.

Training Data Set  Weather Table

Procedure for Decision Trees:

1) Select Classifier option on the top of the Menu bar.


2) Select Choose button and click on Tree option.
3) Click on J48.
4) Click on Start button and output will be displayed on the right side of the window.
5) Select the result list and right click on result list and select Visualize Tree option.
6) Then Decision Tree will be displayed on new window.

27
lOMoARcPSD|34963378

28

Output:

Decision Tree:

Result: This program has been successfully executed.

28
lOMoARcPSD|34963378

29

EXPERIMENT NO:9

Aim:

To Construct Decision Tree for Customer data and classify it.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Customer
Table. @relation customer
@attribute name {x,y,z,u,v,l,w,q,r,n}
@attribute age {youth,middle,senior}
@attribute income {high,medium,low}
@attribute class {A,B}

@data
x,youth,high,A
y,youth,low,B
z,middle,high,A
u,middle,low,B
v,senior,high,A
l,senior,low,B
w,youth,high,A
q,youth,low,B
r,middle,high,A
n,senior,high,A

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows customer table on weka.

29
lOMoARcPSD|34963378

30

Training Data Set  Customer Table

Procedure for Decision Trees:

1) Select Classifier option on the top of the Menu bar.


2) Select Choose button and click on Tree option.
3) Click on J48.
4) Click on Start button and output will be displayed on the right side of the window.
5) Select the result list and right click on result list and select Visualize Tree option.
6) Then Decision Tree will be displayed on new window.

Output:

30
lOMoARcPSD|34963378

31

Decision Tree:

Result: This program has been successfully executed.

31
lOMoARcPSD|34963378

32

EXPERIMENT NO:10

Aim:

To Construct Decision Tree for Location data and classify it.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Location
Table. @relation location
@attribute age {21,24,25}
@attribute location {hyd,blr,kdp}

@data
21,hyd
21,hyd
24,blr
24,blr
24,blr
24,blr
21,hyd
25,kdp
25,kdp
25,kdp
3) After that the file is saved with .arff file format.
4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows location table on weka.

Training Data Set  Location Table

32
lOMoARcPSD|34963378

33

Procedure for Decision Trees:

1) Select Classifier option on the top of the Menu bar.


2) Select Choose button and click on Tree option.
3) Click on J48.
4) Click on Start button and output will be displayed on the right side of the window.
5) Select the result list and right click on result list and select Visualize Tree option.
6) Then Decision Tree will be displayed on new window.

33
lOMoARcPSD|34963378

34

Output:

Decision Tree:

Result:

This program has been successfully executed.

34
lOMoARcPSD|34963378

35

EXPERIMENT NO:11

Aim: Write a procedure for Employee data using Make Density Based Cluster Algorithm.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Employee
Table. @relation employee
@attribute eid numeric
@attribute ename {raj,ramu,anil,sunil,rajiv,sunitha,kavitha,suresh,ravi,ramana,ram,kavya,navya}
@attribute salary numeric
@attribute exp numeric
@attribute address {pdtr,kdp,nlr,gtr}

@data
101,raj,10000,4,pdtr
102,ramu,15000,5,pdtr
103,anil,12000,3,kdp
104,sunil,13000,3,kdp
105,rajiv,16000,6,kdp
106,sunitha,15000,5,nlr
107,kavitha,12000,3,nlr
108,suresh,11000,5,gtr
109,ravi,12000,3,gtr
110,ramana,11000,5,gtr
111,ram,12000,3,kdp
112,kavya,13000,4,kdp
113,navya,14000,5,kdp
3) After that the file is saved with .arff file format.
4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows employee table on weka.

Training Data Set  Employee Table

35
lOMoARcPSD|34963378

36

Procedure
:
1) Click on Cluster menu. In this there are different algorithms are there.
2) Click on Choose button and then select MakeDensityBasedClusterer algorithm.
3) Click on Start button and then output will be displayed on the screen.

36
lOMoARcPSD|34963378

37

Output:

Result:
The program has been successfully executed.

37
lOMoARcPSD|34963378

38

EXPERIMENT NO:12

Aim: Write a procedure for Clustering Customer data using Simple KMeans Algorithm.

Procedure:

1) Open Start  Programs  Accessories  Notepad


2) Type the following training data set with the help of Notepad for Buying
Table. @relation customer
@attribute name {x,y,z,u,v,l,w,q,r,n}
@attribute age {youth,middle,senior}
@attribute income {high,medium,low}
@attribute class {A,B}

@data
x,youth,high,A
y,youth,low,B
z,middle,high,A
u,middle,low,B
v,senior,high,A
l,senior,low,B
w,youth,high,A
q,youth,low,B
r,middle,high,A
n,senior,high,A

3) After that the file is saved with .arff file format.


4) Minimize the arff file and then open Start  Programs  weka-3-4.
5) Click on weka-3-4, then Weka dialog box is displayed on the screen.
6) In that dialog box there are four modes, click on explorer.
7) Explorer shows many options. In that click on ‘open file’ and select the arff file
8) Click on edit button which shows buying table on weka.

38
lOMoARcPSD|34963378

39

Training Data Set  Customer Table

Procedure:
1) Click on Cluster menu. In this there are different algorithms are there.
2) Click on Choose button and then select SimpleKMeans algorithm.
3) Click on Start button and then output will be displayed on the screen.

39
lOMoARcPSD|34963378

40

Output:

Result:
The program has been successfully executed.

40

Common questions

Powered by AI

WEKA provides a user-friendly interface and diverse algorithms for tasks like decision tree construction and clustering, making it an effective tool for rapid prototyping in data mining. However, its limitations include handling very large datasets due to memory constraints and potentially oversimplified visualization tools, which may not capture complex data relationships adequately .

Association rules reveal different insights depending on the dataset. For buying data, association rules can reveal purchasing patterns based on demographic segments, while for banking data, they might highlight patterns in customer transactions or account activity. This differentiation lies in the attribute types and business contexts, illustrating how rules adapt to dataset-specific correlations .

To create an Employee Table using WEKA, you start by opening Notepad and typing the employee data using the ARFF format. Then, you save the file as an .arff file and open WEKA. Click on 'Explorer', select 'Open file', and choose the saved ARFF file to display the employee table in WEKA .

Visualizing decision trees in data analysis enhances interpretability by allowing users to see the path of decisions and how specific conditions lead to particular outcomes. This visualization helps in understanding the rules generated from the data, validating model assumptions, and communicating results to non-technical stakeholders .

The Make Density Based Cluster Algorithm in WEKA analyzes an Employee dataset by grouping data points into clusters based on density. You select the 'Cluster' menu, choose the MakeDensityBasedClusterer algorithm, and start the process. The algorithm identifies regions in the data space where data points are closely packed together, differentiating them from less dense regions .

To apply the KMeans algorithm to customer data in WEKA, you first load the data file in Explorer. In the 'Cluster' menu, select the SimpleKMeans algorithm and define the number of clusters. Starting the process allows KMeans to partition the data into clusters where each group is similar in terms of attributes like age, income, and class. The expected outcome is a segmented customer base that can be leveraged for targeted marketing .

In WEKA, to add a new attribute to the Weather Table, you first open the ARFF file in Explorer mode. Then, select 'Filters', choose 'Unsupervised', and select the 'Add' attribute filter. Enter the new attribute details including index, type, data format, and nominal label values. Apply the changes to add the new attribute, and save the updated file .

Preprocessing the Employee Table in WEKA involves adding and removing attributes. You choose 'Filters', then 'Unsupervised', and select the 'Add' filter to insert a new attribute with specified parameters. To remove attributes, use the 'Remove' filter, select the unwanted attributes, and apply the changes. This refines the table for subsequent data analysis .

To classify weather data using decision trees in WEKA, you load the weather dataset in Explorer mode, then use the 'Classifier' option and select 'Tree' followed by the J48 algorithm. The tree is built based on the attributes such as outlook, temperature, humidity, and windy conditions to predict the 'play' decision. Visualization tools can display the tree, showing how different attribute conditions lead to classification outcomes .

The purpose of applying association rules is to identify interesting relations between variables in large datasets, which can be valuable for predicting correlations. For buying data, you use WEKA's 'Associate' option, choose the Apriori algorithm, and start the process. It generates rules that reveal significant buying patterns based on age, income, and other attributes .

You might also like