75
Teacher’s Day Data Mining Paul Kennedy School of Software, Faculty of Engineering & IT

Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Teacher’s Day Data Mining

Paul Kennedy School of Software, Faculty of Engineering & IT

Page 3: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Outline

• The exercise: making a dataset

• What is data mining?

• Data mining success stories

• What kind of jobs are available?

• Data mining you!

• My work in kid’s cancer

[email protected]

Page 4: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

The Exercise

• Collect a dataset of measurements of students.

• Visualise the data.

• Predict the gender of students based on the measurements.

• Visualisation and prediction is done using free open source software called R/Rattle.

[email protected]

Page 5: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Running the exercise

1. Make the dataset - measure the students.

2. Describe data mining: visualisation & prediction.

3. Get students to visualise themselves then build predictive models.

4. How these same methods can be applied in the childhood cancer domain.

Page 6: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

R• R: sophisticated, statistical software package, state-of-the-art, powerful,

cross platform, open-source and free.

• Interpreted like Python.

• I use it to teach to my first year undergraduate students.

• http://www.r-project.org/

• R is a language and environment for statistical computing and for graphics.

• It’s available for Linux, MS Windows and MacOS X

• It’s quite sophisticated and contains 1000s of ‘packages’, which implement different statistical and data analytics tools.

• The packages and code lives in CRAN: the Comprehensive R Archive Network which is mirrored throughout the world.

• You can write R scripts into files and run them like [email protected]

Page 9: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Rattle• Rattle is a graphical user

interface to do data analytics.

• It calls R in the background and makes the R learning curve easier.

• It matches up with the CRISP-DM phases.

• This is a very nice text if you feel inspired!

[email protected]

Page 10: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Rattle• Written by Graham

Williams.

• Director of Data Mining at the Australian Taxation Office.

• Rattle is used at the ATO, so it works well in a complex industrial setting with very large data sets.

[email protected]

Page 12: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Installing Rattle

• The easiest way to install R and Rattle is to go to the Rattle web site

• http://rattle.togaware.com

• Then scroll down to the Install section and choose the one you want.

• There is a troubleshooting page and a Google group if you get stuck.

[email protected]

Page 13: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions
Page 14: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Installing Rattle• The only difficulties I have had with getting Rattle installed

are dependencies to other external programs.

• Some dependencies:

• GGobi

• GTK+

• XQuartz (only on Mac OSX)

• Sometimes a DLL problem with Windows.

• Troubleshooting documentation of Google Group will help.

[email protected]

Page 15: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Installing Rattle

• GGobi

• Rattle uses another piece of software called GGobi for the visualisation. GGobi written by AT&T.

• It should be installed, but if not it can be found at: http://www.ggobi.org

• On Windows a 32 bit and a 64 bit version of R is installed. You need to have the matching version of ggobi. So if you run the 32 bit R, you need the 32 bit ggobi and similarly for 64 bit.

• For this exercise it won’t matter if you use 32 or 64 bit R.

[email protected]

Page 16: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions
Page 18: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

1. Generate a dataset of your height, arm length and circumference of head.

2. Visualise you.

3. Use the data to predict your gender.

[email protected]

Page 19: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

The dataset• Suggested attributes

• Name - as an identifier

• Gender - M or F

• Height

• Circumference around head

• Length of arm

• Height etc. are (usually) strongly correlated with gender, so they visualise nicely and are good to make a predictive model.

• If the class is all boys or all girls? Potentially use whether birthday is Jan-Jun or Jul-Dec.

[email protected]

Page 21: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

How to do the measurements?

• The main issues are crowd control and generating and sharing a dataset quickly.

• I had 3 helpers one each to record height, arm length and head circumference.

• They entered information into a spreadsheet on Google Drive.

• I downloaded the spreadsheet as a CSV file onto Dropbox and made a URL pointing to the CSV file.

• I copied the URL into http://tinyurl.com to distribute.

[email protected]

Page 22: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

The data

• It works better if the same person measures the same thing to avoid bias.

• Make sure all the gender is encoded in the same way. So M or F.

• Not a mix of M, m, Male, male, F, female, …

• R/Rattle is case sensitive.

[email protected]

Page 23: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

What is data mining?

[email protected]

Page 24: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

• Data Mining is the analysis of large databases to find novel, commercially valuable and exploitable patterns.

• Aim: discover meaningful insights and knowledge from data.

• Discoveries expressed as models.

[email protected]

Page 25: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

!

• A model

• Captures the essence of the discovered knowledge.

• Can assist in understanding the world.

• Can be used to make predictions.

Models

[email protected]

Page 26: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Data Mining Successes

[email protected]

Page 27: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Helping to catch the backpacker killer

• Australia’s most notorious serial murder case

• Early 1990s, 7 young backpackers murdered.

• Police had developed a profile.

• Huge dataset generated of vehicle records, gym memberships, gun licensing and police records.

• Link analysis software from Sydney company NetMap Analytics, narrowed list of suspects from 18 million to 32, which included the murderer: Ivan Milat.

[email protected]

Page 28: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Predicting the 2012 US election result

• Nate Silver used predictive analytics & statistics to correctly predict outcomes of 50 out of 50 states from polling and related data.

• Republican pundits were confident in their landslide-win predictions. Democrat pundits predicted razor-thin victory.

• Shows the power of a data-centric approach over “gut-feeling”.

[email protected]: Wiki Commons, Official White House Photo by Pete Souza

Page 29: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions
Page 30: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

moviegalaxies.com

the lion, the witch and the [email protected]

Page 31: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

fellowship of the ring

[email protected]

Page 32: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

the return of the king

[email protected]

Page 33: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Data Mining Jobs• Consultant

• analyses the data and builds data mining models

• Manager

• communicates data mining results to customers

• Data Scientist / Researcher

• develops new algorithms

[email protected]

Page 34: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Types of data

[email protected]

• Spreadsheets, ...

• Transactions

• DNA sequences: gtatcct ...

• Text: tweets, emails, documents

• Images

• Sound

• ... anything else you can imagine.

Page 35: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

CRISP-DM [email protected]

Source: Kenneth Jensen / Wikimedia Commons / Public Domain

Page 36: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Finding the business problem can be hard

• Problem: identifying people likely to change to a different phone provider = churn

• Finding: unemployed people over 80 had a most regrettable tendency to churn

• But: the unemployed people over 80 passed away and no incentive program had much impact on decreasing the churn.

[email protected]

Page 37: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Two main modeling approaches

• Unsupervised methods

• Model tries to make sense of the data

• Supervised methods

• Models learns a relationship between inputs and outputs from old data.

• Model can then be used to predict output for new inputs.

[email protected]

Page 38: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

University Friends

Attributes

Instances

[email protected]

Page 39: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Task: Who has better access to other friends?

“structural” [email protected]

Page 41: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Task: Predict whether someone gets sunburned.

The “Class”

The “mining table”[email protected]

Page 42: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

One possible answer: Characterisation of the type of person.

Hair Colour

LotionLotionLotion

sunburned sunburnedno no no

blondeginger

brown

no nonoyes yes

[email protected]

Page 44: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

1. Generate a dataset of your height, arm length and circumference of head.

2. Visualise you.

3. Use the data to predict your gender.

[email protected]

Page 45: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

R/Rattle

• R is a statistical programming language.

• Rattle is a user interface to make it easier to use.

• R/Rattle are big and complex but we will only use a little part of it.

[email protected]

Page 51: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

1. Generate a dataset of your height, arm length and circumference of head.

2. Visualise you.

3. Use the data to predict your gender.

[email protected]

Page 55: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Data Mining for Kids with Cancer

[email protected]

Page 56: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

• Working with Children’s Hospital at Westmead to build a tool to help clinicians to better diagnose and treat childhood cancer

• Visualise patients and predict how a patient will react to treatment by comparing patients with previous patients

Data Mining for Childhood Cancer

[email protected]

Page 57: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

• Cancer is the disease that kills the most kids in Australia.

• ~700 kids diagnosed per year in Australia.

• Cancer is heterogenous.

• More than 50 types & subtypes.

• We want to find a better way to treat children with cancer using biological data.

• Focus: Leukaemia

• Collaborative work between A/Prof Paul Kennedy (UTS) A/Prof Daniel Catchpoole (The Children’s Hospital at Westmead)

[email protected]

Page 58: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Normal Blood Leukaemia

Red Blood Cells

White Blood Cells

Plasma

[email protected]

Page 59: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

• Chemotherapy initially helps, but it’s bad if the cancer relapses (ie. it comes back).

• So treatment is based on the risk of relapse.

• Clinicians group patients into risk categories to treat them.

• Strong treatment is needed for those with a high risk of relapse.

Acute Lymphoblastic Leukaemia

[email protected]

Page 60: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Survival rates on BFM-95 drug trial

Can we identify at diagnosis the 10% of standard risk patients who

will relapse? !

... and give them different therapy.

High Risk

Standard Risk

Medium Risk

Years

Survival

[email protected]

Page 61: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Acute Lymphoblastic Leukaemia

• Goal: identify at diagnosis which patients may not respond to treatment to inform clinician

• Data: gene expression, gene variation, clinical, ...

• Patient-to-patient comparison based on biological background

[email protected]

Page 62: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

singular value decomposition

purple = ALL patientyellow = normal child

Page 63: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

treatment protocol

green = BFM 95red = Study 8 purple = ?

Page 64: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

treatment protocol

Let’s look more closely at these 2 patients.

Page 65: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

treatment protocolgreen = BFM 95red = Study 8 purple = ?

These two patients treated on different drug trials are biologically similar ...

Page 66: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

risk categorygreen = standardyellow = mediumred = highpurple = ?

... but the one on the right was classified by the clinician at lower risk of relapse ...

Page 67: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

relapsedgreen = nored = yes purple = ?

The one classified by the clinician at low risk suffered a relapse.

Page 68: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

deathred = diedgreen = survived

He eventually survived but ...

should he have been originally classed at a higher risk and received a modified therapy?

Page 69: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Can we take a personalised treatment approach and predict at diagnosis how a patient will respond based on their biological similarity to previous patients?

[email protected]

Page 70: Teacher’s Day Data Mining · correctly predict outcomes of 50 out of 50 states from polling and related data.! • Republican pundits were confident in their landslide-win predictions

Neuroblastoma• Cancer of the nervous system.

• Lowest survival rate among childhood cancers.

• Heterogeneous disease. Clinical course may range from spontaneous regression to very aggressive behaviour.

• Analysing the histopathology of tumour samples is time-consuming and error-prone.

• Aim: build a computer-aided diagnosis system

• Build classifiers for morphological features of stained images to help diagnosis.

[email protected]