You are on page 1of 32

융합 캡스톤 디자인1.

Lec 3
(AI, 기초 머신러닝)

2023.03.14

Wireless Internet aNd Network Engineering Research Lab.


Department of electronical and Computer Engineering,
Ajou University, Korea
인공지능(Artificial Intelligence)이란?

q 인공지능

인공지능(AI, Artificial Intelligence)이라는 용어는 1956년 다트머스 회의에서 처음 등장.

존 매카시(John McCarthy) – ‘인공지능’이라는 용어를 만듦


‘인텔리전트한 기계를 만드는 과학과 공학’ 이라 정의

하지만 인텔리전트한 기계의 개념은 여전히 모호.


실제로 인공지능의 개념이 혼란스러운 이유는 아직 인공지능의 정의가 명확하지 않기 때문.

Jongtae Lee
인공지능(Artificial Intelligence)이란?

q ‘인공지능 – 현대적 접근’


Ø (Artificial Intelligence – A Modern Approach)
Ø 네 가지 관점에서 여러가지 정의

인간처럼 생각하는 인간처럼 행동하는


(Thinking Humanly) (Acting Humanly)
New effort to make computers think The art of creating machines that perform
functions that require intelligence when
performed by people

이성적으로 생각하는 이성적으로 행동하는


(Thinking Rationally) (Acting Rationally)

The study of the computations that make it Computional Intelligence is the study of the
possible to perceive, reason, and act. design of intelligent agents.
인공지능 – 현대적 접근

Jongtae Lee
인공지능(Artificial Intelligence)이란?

q 인공지능의 4가지 유형

LV 1. 단순한 제어 프로그램 LV 2. 패턴이 다양한 고전적 인공지능

단순한 제어 프로그램 탑재 제품을 입력과 출력 관계를 맺는 방법의 수가


마케팅적으로 ‘인공지능 탑재’라 광고 극단적으로 많고 세련된 경우
(탐색/추론, 지식베이스 활용)

LV 3. 머신러닝을 받아드린 인공지능 LV 4. 딥러닝을 받아들인 인공지능

데이터를 바탕으로 학습되는 기계학습을 할 때 입력값의 특징을 사람


기계학습 알고리즘 이용 이 입력하지 않고 기계가 직접 학습
(레벨2 + 기계학습 -> 레벨3)

Jongtae Lee
인공지능(Artificial Intelligence)이란?

q 인공지능 vs. 머신러닝 vs. 딥러닝


인공지능

머신러닝

딥러닝

사고나 학습 등 인간이 가진
컴퓨터가 스스로 학습 인간의 뉴런과 비슷한
지적 능력을 컴퓨터를 하여 인공신경망 방식으로 정보
통해 구현하는 기술 인공지능의 성능을 향상 처리
시키는 기술 방법

5
Jongtae Lee
머신러닝(Machine Learning)
q 머신러닝(Machine Learning) 정의
Ø Arthur Lee Samuel 의 1959년 정의

“ 컴퓨터가 명시적으로 프로그램 되지 않고도 학습할 수 있도록 하는 연구 분야“

Ø 일반적인 프로그램
“ A 입력에 B조건이 성립하면 X를 동작시킨다” 를 인간이 작성.

Ø 머신 러닝
A라는 정보를 입력할 때 대답이 X가 되는 조건 B를 찾도록 기계를 학습.

8
Jongtae Lee
머신러닝(Machine Learning)
q 머신러닝(Machine Learning) 정의
Ø Tom Mitchell의 1998년 정의 - 현대에는 Tom Mitchell의 정의를 사용

“ 만약 어떤 작업 T에서 경험 E를 통해 성능 측정 방법인 P로 측정했을 때 성능이


향상된다면 이런 컴퓨터 프로그램은 학습을 한다고 말한다.”

Ø Ex) 필기체 문자 인식

T – 필기체 문자 인식, P- 필기체 인식의 정확도, E – 정답이 표시된 필기체 문자의 입력

이 경우 정답이 표시된 필기체 문자를 입력하여(경험 E를 통해) 성능 P가 향상된다면 이 프로그램은 학습된다고


할 수 있다.

8
Jongtae Lee
머신러닝(Machine Learning)
q 머신러닝(Machine Learning) 분류
Ø Supervised Learning(지도학습)
ü 입력과 결과 값을 이용한 학습
입력 값과 함께 결과값을 같이 주고 학습시키는 방법
ex) 분류, 회귀 – 학습모델 : SVM, Decision Tree, KNN, 선형/로지스터 회귀
Ø Unsupervised Learning(비지도학습)
ü 입력만을 이용한 학습
결과 값(정답) 없이 입력 값 만을 이용하여 학습을 시키는 방법
ex) 군집화, 압축 – 학습모델 : K – means 클러스터링
Ø Reinforcement Learning(강화학습)
ü 결과값 대신 리워드(reward) 주어짐
현재의 상태(State)에서 어떤 행동(Action)을 취하는 것이 최적인지를 학습
ex) Action Selection, Policy Learning – 학습모델 : MDP(Markov Decision Process)

8
Jongtae Lee
머신러닝(Machine Learning)
q 머신러닝(Machine Learning) 분류

8
Jongtae Lee
머신러닝(Machine Learning)
q Supervised learning
Ø To learn with correct answer (Pre-Training Post-Experiment)
Ø Most common problem type in ML
Ø Classification example

① ②
or Training
dog cat
<Input>
Label(ex. File name)


Cat or Dog or

<Output>

9
Jongtae Lee
머신러닝(Machine Learning)
q Unsupervised learning
Ø To learn without correct answer
Ø Clustering example

<Input>

<Output>
Ø Anomaly detection example

신용카드 거래내역 정보

<Input>

<Output> 10
Jongtae Lee
머신러닝(Machine Learning)
q Reinforcement learning
Ø To learn by obtaining some reward from taking some action against a given
environment state on policy.
Ø R/L example

<Reinforcement learning Concept : Markov reward process>

Environment Modified policy


Policy ↓
Agent Action control

<Component> <Result> 11
Jongtae Lee
머신러닝(Machine Learning)
q Reinforcement learning
Ø R/L example

<Cliff Walking Problem>

<Reinforcement learning> 12
Jongtae Lee
머신러닝(Machine Learning)
q

Target Y

입력(Input) 출력(Output)
Black
box

Learning
13
Jongtae Lee
머신러닝(Machine Learning)
q Black-box approach
Ø Input and Output is expressed as a vector(Image, Video, Sound..)
ü 고양이 : [1,0,0], 개:[0,1,0],…)
ü 블랙박스 함수 모델은 다양한 방식으로 구현될 수 있지만 현재는 신경망(Neural Networks)이 선
호됨

Target Y

입력(Input) 출력(Output)
Neural
Networks

Learning
14
Jongtae Lee
머신러닝(Machine Learning)
q Process
① Select Subject
② Select Input Variables and Output Variables
③ Collect Data set
④ Design Neural Networks
⑤ Simulate and modify

→ Find Optimized Model


(Modify Variable, Modify Neural Network, Modify Data set etc….. )

→ How?

15
Jongtae Lee
머신러닝(Machine Learning)
q Linear Regression (선형회귀)

X Y
1 1
2 2
3 3
4 ?

사람의 생각으로 판단한다면?


X = 1,2,3 Y=1,2,3 데이터를 가지고, Y=X 라는 관계식 도출

X=4 , Y=4 를 예측
16
Jongtae Lee
머신러닝(Machine Learning)
q Linear Regression (선형회귀)
(1)

(2)

(3)

I N O
X W, b Y

H(x) = Wx + b → Y = Wx + b

*W : weight(가중치), b : bias(편향)

머신러닝은?
Hypothesis ( H(x) = Wx + b )를 세워 가장 적절한 Hypothesis를 찾는다

그러면 가중치 W는 어떻게 찾을 것인가?


→ How? Use Cost Function (비용 함수) 17
Jongtae Lee
머신러닝(Machine Learning)
q Cost function (Loss function)
Ø Cost function을 통해 오차를 최소화할 수 있는 가중치(W)를 학습
Ø Cost function은 모델이 얼마나 잘못되었는가를 판단

평균제곱오차 (Mean Squared Error, MSE)

m : the number of training data

H(x) = Wx + b

18
Jongtae Lee
머신러닝(Machine Learning)
q

19
Jongtae Lee
머신러닝(Machine Learning)
q Cost function minimization (Formal definition)
Ø Simplified cost function:
ü Cost(W)

Ø Updated cost function :


ü Cost(W)

Gradient

20
Jongtae Lee
머신러닝(Machine Learning)
q Cost function minimization with gradient descent method
Ø

Ø
Iterative computation (until there is no changes)

21
Jongtae Lee
머신러닝(Machine Learning)
q Learning rate
Ø Gradient descent method

Ø Large learning rate à overshooting

https://hunkim.github.io/ml/

22
Jongtae Lee
머신러닝(Machine Learning)
q Learning rate
Ø Gradient descent method

Ø Small learning rate à takes too long, stops at local minimum

https://hunkim.github.io/ml/

23
Jongtae Lee
머신러닝(Machine Learning)
q Local Minima
Ø 극소점이 아닌 기울기가 0인 다른 지점에서 학습이 멈추는 것

ü learning rate를 최적으로 지정하는 Optimizer

24
Jongtae Lee
머신러닝(Machine Learning)
q Linear Regression

X(hours) Y(score)
10 9
9 8 regression
3 5
2 3

X=7 Y=?

26
Jongtae Lee
머신러닝(Machine Learning)
q Linear Regression

Y = 0.6613X + 2.2793

X = 7 , Y = 6.907
27
Jongtae Lee
머신러닝(Machine Learning)
q Multi-Variable linear regression(다중선형회귀)
Ø Example) Final exam score prediction based on multiple Quiz scores
Ø Hypothesis

Ø Cost

X1(quiz1) X2(quiz2) X3(quiz3) Y(final)


73 80 75 152
93 88 93 185
89 91 90 180
96 98 100 196
73 66 70 142
<Multi-variable/feature> 28
Jongtae Lee
머신러닝(Machine Learning)
q Multi-Variable linear regression
Ø Example) Final exam score prediction based on multiple Quiz scores
Ø Hypothesis

X
W

ü 각각의 X들에 대한 가중치 비중을 달리 적용


29
Jongtae Lee
머신러닝(Machine Learning)
q Hypothesis using matrix

ü 샘플이 [5,3]일 때, 결과가 [5,1]이 나온다면?

https://hunkim.github.io/ml/

30
Jongtae Lee
머신러닝(Machine Learning)
q Hypothesis using matrix
Ø Data sample : #5
Ø Variables : #3

https://hunkim.github.io/ml/

31
Jongtae Lee
Thank you !

Q&A
32
Jongtae Lee

You might also like