![Page 1: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/1.jpg)
Data Mining with Weka
Class 1 – Lesson 1
Introduction
![Page 2: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/2.jpg)
Data Mining with Weka
… a practical course on how touse Weka for data mining
… explains the basic principles of several popular algorithms
2
![Page 3: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/3.jpg)
Data Mining with Weka
What’s data mining?– We are overwhelmed with data– Data mining is about going from data to information,
information that can give you useful predictions
3
Example?
Data mining vs. machine learning
– You’re at the supermarket checkout.You’re happy with your bargains … … and the supermarket is happy you’ve bought some more stuff
![Page 4: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/4.jpg)
Data Mining with Weka
What’s Weka?– A bird found only in New Zealand?
Data mining workbench Waikato Environment for Knowledge Analysis
Machine learning algorithms for data mining tasks• 100+ algorithms for classification• 75 for data preprocessing• 25 to assist with feature selection• 20 for clustering, finding association rules, etc
4
![Page 5: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/5.jpg)
Data Mining with Weka
What will you learn?
Load data into Weka and look at it Use filters to preprocess it Explore it using interactive visualization Apply classification algorithms Interpret the output Understand evaluation methods and their implications Understand various representations for models Explain how popular machine learning algorithms work Be aware of common pitfalls with data mining
Use Weka on your own data… and understand what you are doing!
5
![Page 6: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/6.jpg)
Class 1: Getting started with Weka
Install Weka Explore the “Explorer” interface Explore some datasets Build a classifier Interpret the output Use filters Visualize your data set
6
![Page 7: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/7.jpg)
Course organization
Lesson 1.1
Lesson 1.2
Lesson 1.3
Lesson 1.4
Lesson 1.5
Lesson 1.6
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Activity 1
Activity 2
Activity 3
Activity 4
Activity 5
Activity 6
7
![Page 8: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/8.jpg)
Textbook
This textbook discusses data mining, and Weka, in depth:
Data Mining: Practical machine learning tools and techniques, by Ian H. Witten, Eibe Frank and Mark A. Hall. Morgan Kaufmann, 2011
The ebook format is available
8
![Page 9: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/9.jpg)
Data Mining with Weka
Class 1 – Lesson 2
Exploring the Explorer
![Page 10: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/10.jpg)
Lesson 1.2: Exploring the Explorer
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Lesson 1.1 Introduction
Lesson 1.2 Exploring the Explorer
Lesson 1.3 Exploring datasets
Lesson 1.4 Building a classifier
Lesson 1.5 Using a filter
Lesson 1.6 Visualizing your data
10
![Page 11: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/11.jpg)
Lesson 1.2: Exploring the Explorer
Download fromhttp://www.cs.waikato.ac.nz/ml/weka
(for Windows, Mac, Linux)
Weka 3.6.10(the latest stable version of Weka)(includes datasets for the course)(it’s important to get the right version, 3.6.10)
11
![Page 12: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/12.jpg)
Lesson 1.2: Exploring the Explorer
Performance comparisons
Graphical interface
Command‐line interface
12
![Page 13: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/13.jpg)
Lesson 1.2: Exploring the Explorer
13
![Page 14: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/14.jpg)
Lesson 1.2: Exploring the Explorer
Outlook Temp Humidity Windy PlaySunny Hot High False NoSunny Hot High True NoOvercast Hot High False YesRainy Mild High False YesRainy Cool Normal False YesRainy Cool Normal True NoOvercast Cool Normal True YesSunny Mild High False NoSunny Cool Normal False YesRainy Mild Normal False YesSunny Mild Normal True YesOvercast Mild High True YesOvercast Hot Normal False YesRainy Mild High True No
123456789
1011121314
attributes
instances
14
![Page 15: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/15.jpg)
Lesson 1.2: Exploring the Explorer
open file weather.nominal.arff
15
![Page 16: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/16.jpg)
Lesson 1.2: Exploring the Explorer
attributes
attributevalues
16
![Page 17: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/17.jpg)
Lesson 1.2: Exploring the Explorer
Install Weka Get datasets Open Explorer Open a dataset (weather.nominal.arff) Look at attributes and their values Edit the dataset Save it?
Course text Section 1.2 The weather problem Chapter 10 Introduction to Weka
17
![Page 18: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/18.jpg)
Data Mining with Weka
Class 1 – Lesson 3
Exploring datasets
![Page 19: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/19.jpg)
Lesson 1.3: Exploring datasets
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Lesson 1.1 Introduction
Lesson 1.2 Exploring the Explorer
Lesson 1.3 Exploring datasets
Lesson 1.4 Building a classifier
Lesson 1.5 Using a filter
Lesson 1.6 Visualizing your data
![Page 20: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/20.jpg)
Lesson 1.3: Exploring datasets
Outlook Temp Humidity Windy PlaySunny Hot High False NoSunny Hot High True NoOvercast Hot High False YesRainy Mild High False YesRainy Cool Normal False YesRainy Cool Normal True NoOvercast Cool Normal True YesSunny Mild High False NoSunny Cool Normal False YesRainy Mild Normal False YesSunny Mild Normal True YesOvercast Mild High True YesOvercast Hot Normal False YesRainy Mild High True No
123456789
1011121314
attributes
instances
20
![Page 21: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/21.jpg)
Lesson 1.3: Exploring datasets
open file weather.nominal.arff
attributes
attributevalues
class
21
![Page 22: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/22.jpg)
Lesson 1.3: Exploring datasets
Classification
classified example
sometimes called “supervised learning”
discrete: “classification” problemcontinuous: “regression” problem
discrete (“nominal”)continuous (“numeric”)
attribute 1attribute 2
class
instance:fixed set of features…
attribute n
Dataset: classified examples
“Model” that classifies new examples
22
![Page 23: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/23.jpg)
Lesson 1.3: Exploring datasets
open file weather.numeric.arff
attributes
attributevalues
class
23
![Page 24: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/24.jpg)
Lesson 1.3: Exploring datasets
open file glass.arff
24
![Page 25: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/25.jpg)
Lesson 1.3: Exploring datasets
The classification problem weather.nominal, weather.numeric Nominal vs numeric attributes ARFF file format glass.arff dataset Sanity checking attributes
Course textSection 11.1 Preparing the data
Loading the data into the Explorer29
![Page 26: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/26.jpg)
Data Mining with Weka
Class 1 – Lesson 4
Building a classifier
![Page 27: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/27.jpg)
Lesson 1.4: Building a classifier
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Lesson 1.1 Introduction
Lesson 1.2 Exploring the Explorer
Lesson 1.3 Exploring datasets
Lesson 1.4 Building a classifier
Lesson 1.5 Using a filter
Lesson 1.6 Visualizing your data
27
![Page 28: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/28.jpg)
Lesson 1.4: Building a classifier
Open file glass.arff(or leave it open from the
last lesson)
Check the available classifiers Choose the J48 decision tree learner (trees>J48) Run it Examine the output Look at the correctly classified instances
… and the confusion matrix
Use J48 to analyze the glass dataset
28
![Page 29: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/29.jpg)
Lesson 1.4: Building a classifier
Open the configuration panel Check the More information Examine the options Use an unpruned tree Look at leaf sizes Set minNumObj to 15 to avoid small leaves Visualize tree using right‐click menu
Investigate J48
29
![Page 30: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/30.jpg)
Lesson 1.4: Building a classifier
ID3 (1979) C4.5 (1993) C4.8 (1996?) C5.0 (commercial)
From C4.5 to J48
J48
30
![Page 31: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/31.jpg)
Lesson 1.4: Building a classifier
Classifiers in Weka Classifying the glass dataset Interpreting J48 output J48 configuration panel … option: pruned vs unpruned trees … option: avoid small leaves J48 ~ C4.5
Course text Section 11.1 Building a decision tree
Examining the output35
![Page 32: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/32.jpg)
Data Mining with Weka
Class 1 – Lesson 5
Using a filter
![Page 33: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/33.jpg)
Lesson 1.5: Using a filter
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Lesson 1.1 Introduction
Lesson 1.2 Exploring the Explorer
Lesson 1.3 Exploring datasets
Lesson 1.4 Building a classifier
Lesson 1.5 Using a filter
Lesson 1.6 Visualizing your data
33
![Page 34: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/34.jpg)
Lesson 1.5: Using a filter
Open weather.nominal.arff (again!) Check the filters
– supervised vs unsupervised– attribute vs instance
Choose the unsupervised attribute filter Remove Check the More information; look at the options Set attributeIndices to 3 and click OK Apply the filter Recall that you can Save the result Press Undo
Use a filter to remove an attribute
34
![Page 35: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/35.jpg)
Lesson 1.5: Using a filter
Supervised or unsupervised? Attribute or instance? Look at them Select RemoveWithValues Set attributeIndex Set nominalIndices Apply Undo
Remove instances where humidity is high
35
![Page 36: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/36.jpg)
Lesson 1.5: Using a filter
Open glass.arff Run J48 (trees>J48) Remove Fe Remove all attributes except RI and MG Look at the decision trees
Use right‐click menu to visualize decision trees
Fewer attributes, better classification!
36
![Page 37: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/37.jpg)
Lesson 1.5: Using a filter
Filters in Weka Supervised vs unsupervised,
attribute vs instance To find the right one, you need to look! Filters can be very powerful Judiciously removing attributes can
– improve performance– increase comprehensibility
Course text Section 11.2 Loading and filtering files
41
![Page 38: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/38.jpg)
Data Mining with Weka
Class 1 – Lesson 6
Visualizing your data
![Page 39: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/39.jpg)
Lesson 1.6: Visualizing your data
Class 1Getting started with Weka
Class 2Evaluation
Class 3Simple classifiers
Class 4More classifiers
Class 5Putting it all together
Lesson 1.1 Introduction
Lesson 1.2 Exploring the Explorer
Lesson 1.3 Exploring datasets
Lesson 1.4 Building a classifier
Lesson 1.5 Using a filter
Lesson 1.6 Visualizing your data
39
![Page 40: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/40.jpg)
Open iris.arff Bring up Visualize panel Click one of the plots; examine some instances Set x axis to petalwidth and y axis to petallength Click on Class colour to change the colour Bars on the right change correspond to attributes: click for x axis;
right‐click for y axis Jitter slider Show Select Instance: Rectangle option Submit, Reset, Clear and Save
Using the Visualize panel
Lesson 1.6: Visualizing your data
40
![Page 41: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/41.jpg)
Run J48 (trees>J48) Visualize classifier errors (from Results list) Plot predictedclass against class Identify errors shown by confusion matrix
Visualizing classification errors
Lesson 1.6: Visualizing your data
41
![Page 42: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/42.jpg)
Get down and dirty with your data Visualize it Clean it up by deleting outliers Look at classification errors
– (there’s a filter that allows you to add classifications as a new attribute)
Course textSection 11.2 Visualization
Lesson 1.6: Visualizing your data
42
![Page 43: Data with Weka - جامعة نزوى · 2016-10-12 · Data Mining with Weka What’s data mining? – We are overwhelmed with data – Data mining is about going from data to information,](https://reader036.vdocuments.net/reader036/viewer/2022070711/5ec90b331e41154d566e3480/html5/thumbnails/43.jpg)
Data Mining with Weka