Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all...

18
Learn to Use Weka Learn to Use Weka Jue Wang (Joyce) Department of Computer Science, University of Massachusetts, Boston Feb-09-2010 Outline Introduction of Weka • Explorer Filter Classify Cluster Experimenter Experimenter • KnowledgeFlow Simple CLI Simple CLI 2

Transcript of Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all...

Page 1: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Learn to Use WekaLearn to Use Weka

Jue Wang (Joyce)Department of Computer Science,

University of Massachusetts, Boston

Feb-09-2010

Outline

• Introduction of Weka

• Explorerp

Filter

Classifyy

Cluster

• ExperimenterExperimenter

• KnowledgeFlow

• Simple CLI• Simple CLI

2

Page 2: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

What is Weka?

Copyright: Martin Kramer ([email protected])

Waikato Environment for Knowledge

A l i( @ )

3

Analysis

Introduction of Weka

• Machine learning/data mining software written in Java (distributed under the GNU Public License)

Support MS Windows, Mac OS X and GNU/LinuxSupport MS Windows, Mac OS X and GNU/Linux

• Used for research, education, and applications

• Main features:

Comprehensive set of data pre processing tools learningComprehensive set of data pre-processing tools, learning algorithms and evaluation methods

Graphical user interfaces (incl. data visualization)

fEnvironment for comparing learning algorithms

4

Page 3: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Data Set% This is a toy example the UCI weather dataset Comment lines at the beginning of the dataset should give an% This is a toy example, the UCI weather dataset.% Any relation to real weather is purely coincidental.

Comment lines at the beginning of the dataset should give an indication of its source, context and meaning.

@relation golfWeatherMichigan_1988/02/10_14days Here we state the internal name of the dataset. Try to be as comprehensive as possible.

@attribute outlook {sunny, overcast, rainy}@attribute windy {TRUE, FALSE}

Here we define two nominal attributes, outlook and windy. The former has three values: sunny, overcast and rainy; the latter two: TRUE and FALSE. Nominal values with special characters, commas or spaces are enclosed in ’single quotes’.

@attribute temperature real@attribute humidity real

These lines define two numeric attributes. Instead of real, integer or numeric can also be used. While double floating point values are stored internally, only seven decimal digits are usually processed.

@ ib l { } Th l ib i h d f l l i bl d f@attribute play {yes, no} The last attribute is the default target or class variable used for prediction. In our case it is a nominal attribute with two values, making this a binary classification problem.

@dataFALSE 85 85

The rest of the dataset consists of the token @data, followed byt d l f th tt ib t lisunny,FALSE,85,85,no

sunny,TRUE,80,90,noovercast,FALSE,83,86,yesrainy,FALSE,70,96,yesrainy,FALSE,68,?,yes

comma‐separated values for the attributes – one line per  example. In our case there are five examples.

y, , , ,y

More details: http://www.cs.waikato.ac.nz/~ml/weka/arff.htmlhttp://www.cs.waikato.ac.nz/~ml/weka/arff.html5

Explorer

6

Page 4: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Explorer

• Filtertransforms datasets:transforms datasets:

removing or adding attributes

resampling the datasetresampling the dataset

removing examples

7

Explorer• FilterFilter

8

Page 5: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Explorer• ClassifyClassify

9

Explorer• ClusterCluster

10

Page 6: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Experimenter

11

Experimenter

• Experimenter makes it easy to compare the performance of different learning schemes

F l ifi ti d i bl• For classification and regression problems

• Results can be written into file or database

• Evaluation options: cross-validation learning• Evaluation options: cross-validation, learning

curve, hold-out

• Can also iterate over different parameter settingsp g

• Significance-testing built in!

12

Page 7: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

KnowledgeFlow

13

KnowledgeFlow

• New graphical user interface for WEKA

• Java-Beans-based interface for setting up and i hi l i i trunning machine learning experiments

• Data sources, classifiers, etc. are beans and can be connected graphicallyconnected graphically

• Data “flows” through components: e.g.,

“data source” -> “filter” -> “classifier” ->

“evaluator”

• Layouts can be saved and loaded again later

14

Page 8: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

15

16

Page 9: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

17

18

Page 10: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

19

20

Page 11: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

21

22

Page 12: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

23

24

Page 13: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

25

26

Page 14: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

27

28

Page 15: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

29

30

Page 16: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

31

32

Page 17: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Simple CLI

33

Simple CLI

• The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle of the CLASSPATH (it facilitates the one, with which Weka was started)Weka was started).

• The Simple CLI is the place for you test the code calling Weka from other programcode calling Weka from other program.

34

Page 18: Learn to Use WekaLearn to Use Weka · Simple CLI • The Simple CLI provides full access to all Weka classes, i.e., classifiers, filters, clusterers, etc., but without the hassle

Simple CLI

java <classname> [<args>] invokes a java class with the given arguments (if any)

break stops the current thread e g a runningbreak stops the current thread, e.g., a running classifier, in a friendly manner

kill stops the current thread, e.g., a running classifier in a friendly mannerclassifier, in a friendly manner

cls clears the output area

exit exits the Simple CLI

help [<command>] provides an overview of the available commands if without a command name as argument, otherwise more help on the specified commandspecified command

35

ThanksThanks

36