• Tidak ada hasil yang ditemukan

3 Studi Kasus Machine Learning dan Data Mining

N/A
N/A
Protected

Academic year: 2019

Membagikan "3 Studi Kasus Machine Learning dan Data Mining"

Copied!
42
0
0

Teks penuh

(1)

STUDI KASUS

MACHINE LEARNING

DAN DATA MINING

(2)

Kelas Logistik dan Jadwal

36 Pertemuan

Software yang digunakan

Python 3

TensorFlow (TF) + Keras

(3)

Daftar isi

Terminologi AI, Machine Learning dan data mining

Learning data untuk model

Tipe-tipe Tugas Belajar (Learning Tasks)

Pendefinisian tugas belajar (Learning Task)

Contoh-contoh kasus machine Learning

(4)

Terminologi

Sinonim

– Artificial Intelligence

– Machine Learning

– Data mining

Pattern recognition

– Probability and Statistics

– Information theory

– Numerical optimization

– Computational complexity theory

– Control theory (adaptive)

(5)

Machine Learning,Statistics dan Data Mining

Differences in terminology:

Ridge regression = weight-decayFitting = learning

– Held-out data = test data

The emphasis is very different:

A good piece of statistics: Clever proof that a relatively simple estimation procedure is

asymptotically unbiased.

A good piece of machine learning: Demonstration that a complicated algorithm produces impressive results on a specific task.

Data-mining: Using machine learning

techniques on very large databases.

(6)
(7)

“Learning” Data

Learning general models dari a data of particular

examples

• Data tersedia banyak dan murah(data warehouses, data marts); knowledge mahal dan jarang.

Contoh dalam retail: Customer transactions to consumer

behavior:

People who bought “Da Vinci Code” also bought “The Five People You Meet in Heaven” (www.amazon.com)

• Pembuatan model yang a good and useful approximation

(8)

Tipe-tipe Tugas Belajar (Learning Tasks)

Association

Supervised learning

Learn to predict output when given an input vector

Reinforcement learning

Learn action to maximize payoffPayoff is often delayed

• Exploration vs. exploitation

• Online setting

Unsupervised learning

Create an internal representation of the input e.g. form

clusters; extract features

• How do we know if a representation is good?

Big datasets do not come with labels.

(9)

Learning Associations

Basket analysis:

P (Y | X ) probability that somebody who buys X

also buys Y where X and Y are products/services.

(10)

Classification

Example: Credit

scoring

Differentiating

between low-risk and

high-risk customers from their income and

savings

Discriminant: IF income > θ1 AND savings > θ2

(11)

11

Aplikasi-aplikasi Classification

Aka Pattern recognition

Face recognition: Pose, lighting, occlusion (glasses, beard), make-up, hair style

• Character recognition: Different handwriting styles. • Speech recognition: Temporal dependency.

– Use of a dictionary or the syntax of the language.

Sensor fusion: Combine multiple modalities; eg, visual (lip

image) and acoustic for speech

Medical diagnosis: From symptoms to illnesses

(12)

Face Recognition

Training examples of a person

(13)

13

(14)

Penggunaan Supervised

Learning

Prediction of future cases: Use the rule to predict

the output for future inputs

Knowledge extraction: The rule is easy to

understand

Compression: The rule is simpler than the data it

explains

Outlier detection: Exceptions that are not covered

(15)

15

Penggunaan Unsupervised Learning

Learning “what normally happens”

Clustering: Grouping similar instances

Example applications

Customer segmentation in CRM (customer relationship

management)

Image compression: Color quantization

(16)

Displaying the structure of a set of documents

(17)

Contoh: Cancer Diagnosis

Application: automatic disease detection

Importance: this is modern/future medical

diagnosis.

Prediction goal: Based on past patients, predict

whether you have the disease

Data: Past patients with and without the diseaseTarget: Cancer or no-cancer

Features: Concentrations of various proteins in

your blood

(18)

Contoh: Zipcodes

Application: automatic zipcode recognition

Importance: this is modern/future delivery of small

goods.

Goal: Based on your handwritten digits, predict

what they are and use them to route mail

Data: Black-and-white pixel valuesTarget: Which digit

Features: ?

(19)

What makes a 2?

(20)

Contoh: Google

Application: automatic ad selection

Importance: this is modern/future advertising.

Prediction goal: Based on your search query,

predict which ads you might be interested in

Data: Past queries

Target: Whether the ad was clickedFeatures: ?

(21)

Contoh: Call Centers

Application: automatic call routing

Importance: this is modern/future customer

service.

Prediction goal: Based on your speech recording,

predict which words you said

Data: Past recordings of various peopleTarget: Which word was intended

Features: ?

(22)

Contoh: Stock Market

Application: automatic program trading

Importance: this is modern/future finance.

Prediction goal: Based on past patterns, predict

whether the stock will go up

Data: Past stock pricesTarget: Up or down

Features: ?

(23)

Contoh :Web-based

• The web contains a lot of data. Tasks with very big datasets often use machine learning

– especially if the data is noisy or non-stationary.

• Spam filtering, fraud detection:

– The enemy adapts so we must adapt too.

• Recommendation systems:

– Lots of noisy data. Million dollar prize!

• Information retrieval:

– Find documents or images with similar content.

(24)

What is a Learning Problem?

• Learning involves performance improving

at some task T – with experience E

evaluated in terms of performance measure

P

• Example: learn to play checkers

Task T: playing checkers

Experience E: playing against itselfPerformance P: percent of games won • What exactly should be learned?

– How might this be represented?

What specific algorithm should be used?

Develop methods, techniques and tools for building intelligent

learning machines, that can solve the problem in combination with an available data set of training

examples.

When a learning machine improves its performance at a given task over time, without reprogramming, it can be said to have learned

something.

(25)

Pendefinisian tugas belajar (Learning

Task)

Improve on task, T, with respect to

performance metric, P, based on experience, E.

T: Playing checkers

P: Percentage of games won against an arbitrary opponent E: Playing practice games against itself

T: Recognizing hand-written words

P: Percentage of words correctly classified

E: Database of human-labeled images of handwritten words

T: Driving on four-lane highways using vision sensors

P: Average distance traveled before a human-judged error

E: A sequence of images and steering commands recorded while observing a human driver.

(26)

Desain sebuah Learning System

• Pilih : training experience

Pilih : what is too be learned, i.e. the target function. • Pilih: how to represent the target function.

Pilih: a learning algorithm to infer the target function

from the experience.

Environment/ Experience

Learner

Knowledge

(27)

Komponen-komponen sebuah Learning Problem

Task: the behavior or task that’s being improved, e.g.

classification, object recognition, acting in an environment.

Data: the experiences that are being used to improve

performance in the task.

Measure of improvements: How can the improvement be measured? Examples:

– Provide more accurate solutions (e.g. increasing the accuracy in prediction)

– Cover a wider range of problems

– Obtain answers more economically (e.g. improved speed)

– Simplify codified knowledge

– New skills that were not presented initially

(28)

What Experience E to Use?

• Direct or indirect?

– Direct: feedback on individual moves

– Indirect: feedback on a sequence of moves

• e.g., whether win or not • Teacher or not?

– Teacher selects board states

• Tailored learning

• Can be more efficient

– Learner selects board states

• No teacher • Questions

– Is training experience representative of performance goal?

– Does training experience represent distribution of outcomes in world?

(29)

What Exactly Should be Learned?

• Playing checkers:

– Alternating moves with well-defined rules

– Choose moves using some function

– Call this function the Target Function

Target function (TF): function to be learned during a learning process

ChooseMove: Board  Move

ChooseMove is difficult to learn, e.g., with indirect training examples

 A key to successful learning is to choose appropriate target function:

 Strategy: reduce learning to search for TF

• Alternative TF for checkers:

V : Board  R

– Measure “quality” of the board state

– Generate all moves

• choose move with largest value

(30)

A Possible Target Function

V

For

Checkers

In checkers, know all legal moves

From these, choose best move in any situation

Possible V function for checkers:

if b is a final board state that is win, then V(b) = 100if b is a final board state that is loss, then V(b) = -100

if b is a final board state that is draw, then V(b) = 0

if b is a not a final state in the game, then V(b) = V(b), where b is the

best final board state that can be achieved starting from b and playing optimally until the end of the game

This gives correct values, but is not operational

So may have to find good approximation to VCall this approximation V

(31)

How Might Target Function be Represented?

• Many possibilities (subject of course)

– As collection of rules ?

As neural network ?

– As polynomial function of board features ?

• Example of linear function of board features:

w0+ w1bp(b) + w2rp(b) + w3bk(b)+w4rk(b)+w5bt(b)+w6rt(b)

bp(b) : number of black pieces on board b

rp(b) : number of red pieces on b

bk(b) : number of black kings on b

rk(b) : number of red kings on b

bt(b) : number of red pieces threatened by black (i.e., which can be taken on black's next turn)

rt(b) : number of black pieces threatened by red

• Generally, the more expressive the representation, the more difficult it is to estimate

(32)

Inductive and Deductive Learning

Inductive Learning: Reasoning from a set of

examples to produce a general rules. The rules

should be applicable to new examples, but there is no guarantee that the result will be correct.

Deductive Learning: Reasoning from a set of

known facts and rules to produce additional rules that are guaranteed to be true.

(33)

Assessment of Learning Algorithms

The most common criteria for learning algorithms

assessments are:

– Accuracy (e.g. percentages of correctly classified +’s and –’s)

– Efficiency (e.g. examples needed, computational tractability)

Robustness (e.g. against noise, against incompleteness) – Special requirements (e.g. incrementality, concept drift)

– Concept complexity (e.g. representational issues – examples & bookkeeping)

– Transparency (e.g. comprehensibility for the human user)

(34)
(35)
(36)
(37)

Data mining dan algorithms

• Data Mining

– The desired outcome from data mining is to create a model from a given dataset that can have its insights generalized to similar datasets. A real-world example of a successful data mining application can be seen

in automatic fraud detection from banks and credit institutions.

– Data mining is the process of discovering predictive information from the

analysis of large databases. For a data scientist, data mining can be a vague and daunting task – it requires a diverse set of skills and knowledge of many data mining techniques to take raw data and successfully get insights from it.  You’ll want to understand the foundations of statistics, and 

(38)

Teknik-teknik Data mining

Regression – Estimating the relationships between variables by optimizing the reduction of error.

Classification – Identifying what category an object belongs to. An example is classifying email as spam or legitimate, or looking at a person’s credit score and approving or denying a loan request.

Cluster Analysis – Finding natural groupings of data objects based upon the known

characteristics of that data. An example could be seen in marketing, where analysis can reveal customer groupings with unique behavior – which could be applied in business strategy

decisions.

Association and Correlation Analysis – Looking to see if there are unique relationships between variables that are not immediately obvious. An example would be the famous case of beer and diapers: men who bought diapers at the end of the week were much more likely to buy beer, so stores placed them close to each other to increase sales.

(39)

Contoh pemakaian panda pada model regresi pada Python

Menghitung relasi linear diantara variabel yang

tersedia, menggunakan data dari 

House Sales in King’s County data set from

Kaggle.

(40)

Python script

import pandas as pd

import matplotlib.pyplot as plt import numpy as np

import scipy.stats as stats import seaborn as sns

from matplotlib import rcParams

(41)

Tampilan Hasil

(42)

df.describe()

Referensi

Dokumen terkait

Penelitian ini bertujuan mengana- lisis proses data mining dalam sistem pembelajaran berbantuan komputer pada praktikum kelas gabungan Laboratorium Sistem

Data mining is the process of automatically searching large amount of data for patterns and recognition of specific characteristics. A statistical perspective of Data Mining

In the case study, we performed a data mining experiment in which data mining techniques were used in assessing the impact of different software project activities

The specific objectives were (1) to introduce the Cross-Industry Standard Process for Data Mining (CRISP-DM) as a process framework and Knime Analytics Platform as a data

Berdasarkan latar belakang tersebut, penelitian Skripsi ini akan membangun sebuah aplikasi data mining dengan judul “ Implementasi Data Mining untuk Memprediksi Masa Studi

Section 3 describes the data mining task on educational system and brief review the methods of SSVM classification and kernel k-means clustering.. Section 4 gives a

Data discretization in data mining Data discretization converts a large number of data values into smaller once, so that data evaluation and data management becomes very easy.. Data

A review of the data mining process, including data handling, data mining strategies for linked data and knowledge discovery has additionally been given.. The paper characterizes and