Weka Package n n n Weka package is

  • Slides: 59
Download presentation
Weka Package n n n Weka package is open source data mining software written

Weka Package n n n Weka package is open source data mining software written in Java. Weka can be applied to your dataset from the GUI, the command line or called by your own java code. It also provides a variety of tools for preprocessing and evaluating the result of learning algorithms on any given dataset. 3/7/2021 1

Online Documentation n Software website n n n n 3/7/2021 Book: Data Mining: Practical

Online Documentation n Software website n n n n 3/7/2021 Book: Data Mining: Practical Machine Learning Tools and Techniques with Java Implementations User guide for the Explorer GUI User guide for the Experimenter GUI ARFF file format API documentation Collections of datasets Weka-related Projects 2

Input: ARFF file format n The data must be converted to ARFF n n

Input: ARFF file format n The data must be converted to ARFF n n @RELATION declaration associates a name with the dataset n n n @RELATION <relation-name> @ATTRIBUTE declaration specifies the name and type of an attribute n @attribute <attribute><data type> n Data type can be numeric, nominal, string or data @DATA declaration is a single line denoting the start of the data segment n 3/7/2021 Required declarations of @RELATION, @ATTRIBUTE and @DATA Missing values are represented by ? 3

Data Example @relation weather @attribute @attribute outlook {sunny, overcast, rainy} temperature real humidity real

Data Example @relation weather @attribute @attribute outlook {sunny, overcast, rainy} temperature real humidity real windy {TRUE, FALSE} play {yes, no} @data sunny, 85, FALSE, no sunny, 80, 90, TRUE, no overcast, 83, 86, FALSE, yes rainy, 70, 96, FALSE, yes ………… 3/7/2021 4

Weka GUI n Strat->Programs->Data Mining Tools->Weka-3 -2 3/7/2021 5

Weka GUI n Strat->Programs->Data Mining Tools->Weka-3 -2 3/7/2021 5

Weka GUI - Experimenter n Convenient Environment for creating, running, modifying and analyzing experiments.

Weka GUI - Experimenter n Convenient Environment for creating, running, modifying and analyzing experiments. 3/7/2021 6

Defining an Experiment n n Initialize an experiment: click on “new”, system loads the

Defining an Experiment n n Initialize an experiment: click on “new”, system loads the default parameters. Define dataset to be processed in dataset panel n n 3/7/2021 Select “use relative paths” Click on “add new” 7

Defining an Experiment 3/7/2021 8

Defining an Experiment 3/7/2021 8

Saving result of the experiment n Click on the “CSVResult. Listener” entry in the

Saving result of the experiment n Click on the “CSVResult. Listener” entry in the Destination panel. n Click on “output. File” in the new popped window n Type the name of the output file, click Select n The file name is displayed in the output. File panel. 3/7/2021 9

Saving result of the experiment 3/7/2021 10

Saving result of the experiment 3/7/2021 10

Saving the experiment definition n n 3/7/2021 Select “Save…” at the top of the

Saving the experiment definition n n 3/7/2021 Select “Save…” at the top of the setup window. Type the dataset name with the extension “exp” The experiment can be restored by selecting Open in the setup window and then selecting the file in the dialog window Click Start to run the experiment. 11

Saving the experiment definition 3/7/2021 12

Saving the experiment definition 3/7/2021 12

Running an experiment n n 3/7/2021 Click the Run tab at the top of

Running an experiment n n 3/7/2021 Click the Run tab at the top of the window. The current experiment performs 10 randomized train and test runs on the Iris dataset, using 66% of the patterns for training and 34% for testing, and using the Zero. R scheme. The results of the experiment are saved to the dataset experiment. txt The results are generated in comma-separated value (CSV) form and can be loaded into a spreadsheet for analysis. 13

Running an experiment 3/7/2021 14

Running an experiment 3/7/2021 14

Running result 3/7/2021 15

Running result 3/7/2021 15

Changing the Experiment Parameters n n 3/7/2021 Clicking on the Result. Generator panel. Click

Changing the Experiment Parameters n n 3/7/2021 Clicking on the Result. Generator panel. Click on the split. Evaluator entry to display the Split. Evaluator properties Click on the classifier entry(Zero. R) to display the scheme properties Click on the drop-down list for the scheme to select a different scheme. 16

Changing the Experiment Parameters 3/7/2021 17

Changing the Experiment Parameters 3/7/2021 17

Adding Additional Schemes n n n 3/7/2021 Additional Schemes can be added in the

Adding Additional Schemes n n n 3/7/2021 Additional Schemes can be added in the Generator properties panel. To begin, change the dropdown list entry from Disabled to Enabled in the Generator properties panel. Click Select property and expand split. Evaluator so that the classifier entry is visible in the property list; click Select. The scheme name is displayed in the Generator properties panel. Now when the experiment is run, results are generated for both schemes. 18

Adding Additional Schemes 3/7/2021 19

Adding Additional Schemes 3/7/2021 19

Adding Additional Schemes 3/7/2021 20

Adding Additional Schemes 3/7/2021 20

Adding Additional Datasets n n n 3/7/2021 The scheme(s) may be run on any

Adding Additional Datasets n n n 3/7/2021 The scheme(s) may be run on any number of datasets at a time. Additional datasets are added by clicking “Add new …” in the Datasets panel. Datasets are deleted from the experiment by selecting the dataset and then clicking Delete Selected. 21

Raw Output n The output generated by a scheme can be saved to a

Raw Output n The output generated by a scheme can be saved to a file and then examined at a later time n Open the Result Producer window by clicking on the Result Generator panel in the Setup window. n Click on raw. Output and select the True entry from the drop-down list. n n 3/7/2021 By default, the output is sent to the file split. Evaluator. Out. zip. The output file can be changed by clicking on the output. File panel in the window. Now when the experiment is run, the result of each processing run is archived. 22

Raw Output 3/7/2021 23

Raw Output 3/7/2021 23

Raw Output 3/7/2021 24

Raw Output 3/7/2021 24

Instances Result Producer n n 3/7/2021 Results can also be sent to an Instances

Instances Result Producer n n 3/7/2021 Results can also be sent to an Instances Result Listener and then analysed by the Weka Experiment Analyser. Click on the result listener portion of the Destination panel and then select Instances Result Listener. Then select the output dataset. The dataset extension should be “arff”. When this experiment is run, results are generated in “arff” format. 25

Instances Result Producer 3/7/2021 26

Instances Result Producer 3/7/2021 26

Instances Result Producer n n n n n n 3/7/2021 @relation Instance. Result. Listener

Instances Result Producer n n n n n n 3/7/2021 @relation Instance. Result. Listener @attribute Key_Dataset {iris} @attribute Key_Run {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} @attribute Key_Scheme {weka. classifiers. Zero. R} @attribute Key_Scheme_options {''} @attribute Key_Scheme_version_ID {6077547173920530258} @attribute Date_time numeric @attribute Number_of_instances numeric @attribute Number_correct numeric @attribute Number_incorrect numeric @attribute Number_unclassified numeric @attribute Percent_correct numeric … @data iris, 1, weka. classifiers. Zero. R, '', 6077547173920530258, 20010205. 1546, 51, 15, 36, 0, 29. 411765, 70. 588235, 0, 0. 446239, 0. 473777, 100, 81. 592363, 0, 1. 59985, 0, 0, 1, 31, 1, 20, 0, ? iris, 2, weka. classifiers. Zero. R, '', 6077547173920530258, 20010205. 1546, 51, 11, 40, 0, 21. 568627, 78. 431373, 0, 0. 451365, 0. 480492, 100, 83. 584631, 0, 1. 638914, 0, 0, 1, 31, 1, 20, 0, ? iris, 3, weka. classifiers. Zero. R, '', 6077547173920530258, 20010205. 1546, 51, 15, 36, 0, 29. 411765, 70. 588235, 0, 0. 446239, 0. 473777, 100, 81. 592363, 0, 1. 59985, 0, 0, 1, 35, 1, 16, 0, 0, 0, ? 27

Experiment Analyzer n n Analyze the results of experiments that were sent to an

Experiment Analyzer n n Analyze the results of experiments that were sent to an Instances Result Listener The experiment shown below uses 3 schemes, Zero. R, One. R, and j 48. J 48, to classify the Iris data in an experiment using 10 train and test runs, with 66%of the data used for training and 34% used for testing. 3/7/2021 28

Experiment Analyzer n n Run the experiment. Analyse tab -> Perform test to generate

Experiment Analyzer n n Run the experiment. Analyse tab -> Perform test to generate a comparison of the 3 schemes. The percentage correct for each of the 3 schemes is shown in each dataset row. The annotation “v” or “*” indicates that a specific result is statistically better (v) or worse (*) than the baseline scheme at the significance level specified 3/7/2021 29

Experiment Analyzer 3/7/2021 30

Experiment Analyzer 3/7/2021 30

Changing the Baseline Scheme 3/7/2021 31

Changing the Baseline Scheme 3/7/2021 31

Summary Test 3/7/2021 32

Summary Test 3/7/2021 32

Ranking Test 3/7/2021 33

Ranking Test 3/7/2021 33

Cross-Validation Result Producer n Change from random train and test experiments to cross-validation experiments.

Cross-Validation Result Producer n Change from random train and test experiments to cross-validation experiments. 3/7/2021 34

Explorer GUI n n n Explorer GUI: different preparation, transformation and modeling algorithms on

Explorer GUI n n n Explorer GUI: different preparation, transformation and modeling algorithms on a dataset Experimenter GUI: run different algorithms in batch and to compare the results Tabs: n n n 3/7/2021 Preprocess Classify Cluster Associate Select attributes Visualize 35

Explorer GUI 3/7/2021 36

Explorer GUI 3/7/2021 36

Preprocessing n n Opening files Base relation and working relation n Base relation: originally

Preprocessing n n Opening files Base relation and working relation n Base relation: originally loaded version of data, unchanged during performing actions. Working relation: copy of base relation, changed when any filters are applied to the data. Working with attributes n n 3/7/2021 Attributes in base relation Attributes info for base relation 37

Preprocessing 3/7/2021 38

Preprocessing 3/7/2021 38

Working with Filters n n Preprocess section allows filters to be defined. Filters transform

Working with Filters n n Preprocess section allows filters to be defined. Filters transform the data in various ways. n n E. g. Discretize. Filter - discretizes a range of numeric attributes in the dataset into nominal attributes. E. g. Nominal. To. Binary. Filter – transform nominal data to n-1 bits binary fileter (n is the number of categories) Multiple filters can be applied onto data Transformation results are save in working relation 3/7/2021 39

Classification n n Select classification algorithms Test options n n n Use training set

Classification n n Select classification algorithms Test options n n n Use training set Supplied test set Cross-validation Percentage split Click start to run the classification 3/7/2021 40

Classification 3/7/2021 41

Classification 3/7/2021 41

Classification n The classifier output text n n n 3/7/2021 Run information: gives relation

Classification n The classifier output text n n n 3/7/2021 Run information: gives relation name, instances, attributes and test mode. Classifier model: a textual representation of the model Summary: a list of statistics summarizing of accuracy Detailed accuracy by class: more detailed per-class break down of the prediction accuracy. Confusion Matrix: show many instances have been assigned to each class. 42

Classification 3/7/2021 43

Classification 3/7/2021 43

Clustering n n n Cluster modes Ignoring attributes Learning clusters 3/7/2021 44

Clustering n n n Cluster modes Ignoring attributes Learning clusters 3/7/2021 44

Clustering 3/7/2021 45

Clustering 3/7/2021 45

Associating n n Setting up Learning association 3/7/2021 46

Associating n n Setting up Learning association 3/7/2021 46

Associating 3/7/2021 47

Associating 3/7/2021 47

Selecting attributes n n n Searching and evaluating Options Performing selection 3/7/2021 48

Selecting attributes n n n Searching and evaluating Options Performing selection 3/7/2021 48

Selecting attributes 3/7/2021 49

Selecting attributes 3/7/2021 49

Visualizing n n Changing the view Selecting instances 3/7/2021 50

Visualizing n n Changing the view Selecting instances 3/7/2021 50

Visualizing instances 3/7/2021 51

Visualizing instances 3/7/2021 51

Visualizing instances 3/7/2021 52

Visualizing instances 3/7/2021 52

Visualizing instances 3/7/2021 53

Visualizing instances 3/7/2021 53

Visualizing instances 3/7/2021 54

Visualizing instances 3/7/2021 54

Visualizing instances 3/7/2021 55

Visualizing instances 3/7/2021 55

Visualizing output 3/7/2021 56

Visualizing output 3/7/2021 56

Visualizing output 3/7/2021 57

Visualizing output 3/7/2021 57

Tutorial is the combination of following sources n User guide for the Explorer GUI

Tutorial is the combination of following sources n User guide for the Explorer GUI n Tutorial for the experiment GUI n Machine learning algorithms for java n Short tutorial for weka(1) n Short tutorial for weka(2) n Software for the data mining course 3/7/2021 58

Thank you !!! 3/7/2021 59

Thank you !!! 3/7/2021 59