30
Bmôn KHMT, Khoa CNTT, HUA Hanoi, Nov. 2010 Trí tunhân to nâng cao Chuyên đề: Mtsphương pháp hc máy tiên tiến và ng dng (Advanced machine learning techniques and applications) GV: Nguyn ThThy

Ml Ch2 Neuralnetwork

Embed Size (px)

DESCRIPTION

1lagithikhongbiet2

Citation preview

Page 1: Ml Ch2 Neuralnetwork

Bộ môn KHMT, Khoa CNTT, HUAHanoi, Nov. 2010

Trí tuệ nhân tạo nâng cao

Chuyên đề: Một số phương pháp học máy tiên tiến và ứng dụng(Advanced machine learning techniques and applications)

GV: Nguyễn Thị Thủy

Page 2: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 2 HUA, Nov. 2010

Nội dung

♦ Ch1: Tổng quan về học máy (Machine learning)♦ Ch2: Mạng nơ-ron và Giải thuật di truyền

– Mạng nơ-ron (Artificial neural network)– Giải thuật di truyền (Genetic algorithm*)

♦ Ch3: Support Vector Machines (SVMs)– Lý thuyết– Ứng dụng

♦ Ch4: Phương pháp học tổ hợp (Ensemble learning)– Boosting and bagging– Online boosting

♦ Ch5: Case study– Ứng dụng của ML trong Thị giác máy tính, trong khai phá dữ liệu, trong

Nông nghiệp

Page 3: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 3 HUA, Nov. 2010

Nội dung

1. Giới thiệu về NN

2. Cấu trúc và phân loại mạng nơ-ron

3. Vấn đề học của NN

4. Sử dụng ANN Toolbox trong Matlab

Giải thuật Di truyền (Genetic Algorithm, GA – nếu có thời gian)

Page 4: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 4 HUA, Nov. 2010

I- Artificial Neural Network (ANN)

Page 5: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 5 HUA, Nov. 2010

Introduction

♦ People are much better than computers at recognizing patterns. How do they do it?

– Neurons in the perceptual system represent features of the sensory input. – The brain learns to extract many layers of features. Features in one layer represent

combinations of simpler features in the layer below.

♦ Can we train computers mimicking the way the brain does it?– Nobody knows how the brain does it, so this requires both engineering insights and

scientific discoveries.

Page 6: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 6 HUA, Nov. 2010

Mạng nơ ron sinh học

♦ ~ 100 billion neurons♦ Mỗi neuron có hàng

ngàn kết nối:– Thu nhận tín hiệu– Lan truyền thông

tin

Page 7: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 7 HUA, Nov. 2010

Mạng nơ-ron nhân tạo (Artificial Neural Network)

♦ Neural network: information processing paradigm inspired by biological nervous systems, such as our brain~Computational model of real neurons and an integral part of the disciplines

of machine learning and computational intelligence.♦ Structure: large number of highly interconnected processing elements

(neurons) working together♦ Like people, they learn from experience (by examples)

Page 8: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 8 HUA, Nov. 2010

Cấu trúc mạng nơ-ron

♦ Neural networks are configured for a specific application, such as pattern recognition or data classification, through a learning process

♦ In a biological system, learning involves adjustments to the synaptic connections between neurons (weights)same for artificial neural networks (ANNs)

Page 9: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 9 HUA, Nov. 2010

Mathematical representation

The neuron calculates a weighted sum of inputs and compares it to a threshold. If the sum is higher than the threshold, the output is set to 1, otherwise to -1.

Non-linearity

Page 10: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 10 HUA, Nov. 2010

♦ Neuron model

♦ Transfer functions:

Page 11: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 11 HUA, Nov. 2010

Network architecture

♦ Two or more of the neurons can be combined in a layer, ♦ An ANN could contain one or more such layers. ♦ A single layer NN with R inputs, S neurons is

Page 12: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 12 HUA, Nov. 2010

♦ Multi layers of neurons

Page 13: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 13 HUA, Nov. 2010

Training the network

♦ A simple perceptron: It’s a single-unit network♦ Change the weight by an amount proportional

to the difference between the desired output and the actual output.

Δ Wi = η * (D-Y).Ii

Perceptron Learning Rule

Learning rateDesired output

Input

Actual output

Page 14: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 14 HUA, Nov. 2010

Multilayer Networks and Backpropagation Training

♦ Feedforward network

Page 15: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 15 HUA, Nov. 2010

Training the network

♦ The process of tuning the values of the weights and biases of the network to optimize network performance, i.e. mean square error mse

♦ mse = the average squared error between the network outputs a and the target outputs t.

♦ 2 training modes– Incremental mode: the gradient is computed and the weights are updated

after each input is applied to the network.– Batch mode: all the inputs in the training set are applied to the network

before the weights are updated.

♦ Any optimization algorithm can be used to optimize the performance function!

Page 16: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 16 HUA, Nov. 2010

Training the network

♦ Backpropagation algorithm: performing computations backward through the network.

♦ Training Algorithms:– simplest optimization algorithm — gradient descent (updates the network

weights and biases in the direction in which the performance function decreases most rapidly, the negative of the gradient).

– One iteration:

Page 17: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 17 HUA, Nov. 2010

♦ Training functions in Matlab

Page 18: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 18 HUA, Nov. 2010

ANN Learning

♦ From experience: examples / training data♦ Strength of connection between the neurons is stored as a weight-value

for the specific connection♦ Learning the solution to a problem = changing the connection weights

Page 19: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 19 HUA, Nov. 2010

ANN

♦ Power: Model complex functions, nonlinearity built into the network ♦ Ease of use:

– Learn by example– Very little user domain-specific expertise needed

♦ Intuitively appealing: based on model of biology, will it lead to genuinely intelligent computers/robots?

Neural networks cannot do anything that cannot be done using traditional computing techniques, BUT they can do some things which would

otherwise be very difficult.

Page 20: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 20 HUA, Nov. 2010

Applications

♦ Classification– Image processing– Predict bankruptcy for credit card companies– Risk assessment

♦ Prediction: learning from past experience– pick the best stocks in the market– predict weather– identify people with cancer risk

♦ Recognition– Pattern recognition: SNOOPE (bomb detector in U.S. airports)– Character recognition

Page 21: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 21 HUA, Nov. 2010

Page 22: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 22 HUA, Nov. 2010

Dự báo thời tiết: chuồn chuồn bay thấp thì mưa…♦ Input: ?♦ Output: trời mưa hay nắng?

♦ Input: Nhiệt độ, áp suất, độ ẩm, sức gió…

Page 23: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 23 HUA, Nov. 2010

Các thế hệ ANN

♦ Search for “Artificial neural network”

♦ 3 thế hệ:– Thế hệ 1: Culloch&Pitts, threshold gates– Thế hệ 2: firing rate, sigmoid functions– Mạng nơron thế hệ thứ 3: temporal factor, Spiking neuron (W. Maass,

Henry Markram)

♦ Não “nhân tạo”

– http://ditwww.epfl.ch/cgi-perl/EPFLTV/home.pl?page=channel_one&lang=2&connected=0&channel_id=29

Page 24: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 24 HUA, Nov. 2010

ANN – thế hệ 1

♦ McCulloch & Pitts, 1944: first model of an artificial neurons ~ basic computational elements

♦ Perceptrons (~1960)

Activation function: binary 0, 1 ~ in computer

non-adaptivehand-codedfeatures

output units e.g. class labels

input units e.g. pixels

Bomb Toy

Page 25: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 25 HUA, Nov. 2010

Back-propagate error signal to get derivatives for learning

input vector

hidden layers

outputs

Compare outputs with correct answerto get error signal

ANN – thế hệ 2

Activation function:continous

Page 26: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 26 HUA, Nov. 2010

ANN thế hệ 3

♦ See EPFL clips

Page 27: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 27 HUA, Nov. 2010

ANN thế hệ 3

Page 28: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 28 HUA, Nov. 2010

♦ Ứng dụng:♦ Thế hệ 1 và 2: là các hàm/công cụ tính toán (có thể học), giải quyết bất

kỳ bài toán thực tế nào mà các mô hình tính toán khác có thể làm được♦ Thế hệ 3: Neural microcircuit: hardware implementations, “sillicon

neron”

Page 29: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 29 HUA, Nov. 2010

Ví dụ ứng dụng

♦ Bài toán phân loại/nhận dạng sản phẩm sản xuất (ví dụ: wine dataset, UCI)– http://archive.ics.uci.edu/ml/datasets/Wine

♦ Bài toán nhận dạng ký tự quang (click)

♦ Bài toán đấu thầu thi công (click)

♦ Bài toán xử lý nước thải (click)

Page 30: Ml Ch2 Neuralnetwork

Advanced AI – Neural Network 30 HUA, Nov. 2010

Thực hành

♦ Matlab tutorial:– http://www.mathworks.com/academia/student_center/tutorials/launchpad.ht

ml

♦ ANN Toolbox in Matlab (click here)–

♦ Demo some applications!!

♦ Need Matlab tutorial? Search for “matlab tutorial”, all online, e.g:– http://www.cyclismo.org/tutorial/matlab/– http://www.math.siu.edu/matlab/tutorials.html