L4
L4
Practical Machine
Learning Tools and
Techniques
Weka 3:
Machine Learning Software in Java
Weka is a collection of machine learning algorithms
for data mining tasks. It contains tools for data
preparation, classification, regression, clustering,
association rules mining, and visualization.
From data to information
• Society produces huge amounts of data
• Sources: business, science, medicine, economics, geography,
environment, sports, …
• This data is a potentially valuable resource
• Raw data is useless: need techniques to automatically
extract information from it
• Data: recorded facts
• Information: patterns underlying the data
• We are concerned with machine learning techniques for
automatically finding patterns in data
• Patterns that are found may be represented as structural
descriptions or as black-box models
4
Structural descriptions
• Example: if-then rules
… … … … …
5
Machine learning
• Definitions of “learning” from dictionary:
To get knowledge of by study, Difficult to measure
experience, or being taught
To become aware by information or
from observation
To commit to memory Trivial for computers
To be informed of, ascertain; to receive instruction
• Operational definition:
Things learn when they change their behavior Does a slipper learn?
in a way that makes them perform better in
the future.
7
The weather problem
• Conditions for playing a certain game
8
Classification vs. association rules
• Classification rule:
predicts value of a given attribute (the classification of an example)
• Association rule:
predicts value of arbitrary attribute (or combination)
9
Weather data with mixed attributes
• Some attributes have numeric values
10
The contact lenses data
Age Spectacle prescription Astigmatism Tear production rate Recommended
lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Myope Yes Normal Hard
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal hard
Pre-presbyopic Myope No Reduced None
Pre-presbyopic Myope No Normal Soft
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope No Reduced None
Pre-presbyopic Hypermetrope No Normal Soft
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope No Reduced None
Presbyopic Myope No Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope No Reduced None
Presbyopic Hypermetrope No Normal Soft
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
11
A complete and correct rule set
12
A decision tree for this problem
13
Classifying iris flowers
14
Predicting CPU performance
• Example: 209 different computer configurations
Cycle time Main memory Cache Channels Performance
(ns) (Kb) (Kb)
MYCT MMIN MMAX CACH CHMIN CHMAX PRP
1 125 256 6000 256 16 128 198
2 29 8000 32000 32 8 32 269
…
208 480 512 8000 32 0 0 67
209 480 1000 4000 0 0 0 45
15
Data from labor negotiations
Attribute Type 1 2 3 … 40
Duration (Number of years) 1 2 3 2
Wage increase first year Percentage 2% 4% 4.3% 4.5
Wage increase second year Percentage ? 5% 4.4% 4.0
Wage increase third year Percentage ? ? ? ?
Cost of living adjustment {none,tcf,tc} none tcf ? none
Working hours per week (Number of hours) 28 35 38 40
Pension {none,ret-allw, empl-cntr} none ? ? ?
Standby pay Percentage ? 13% ? ?
Shift-work supplement Percentage ? 5% 4% 4
Education allowance {yes,no} yes ? ? ?
Statutory holidays (Number of days) 11 15 12 12
Vacation {below-avg,avg,gen} avg gen gen avg
Long-term disability assistance {yes,no} no ? ? yes
Dental plan contribution {none,half,full} none ? full full
Bereavement assistance {yes,no} no ? ? yes
Health plan contribution {none,half,full} none ? full half
Acceptability of contract {good,bad} bad good good good
16
Decision trees for the labor data
17
Questions
Thank you