Loading [MathJax]/jax/output/CommonHTML/jax.js

기계학습 30

Chapter 1. Auto-grad(자동미분) step 6~9: 수동 역전파/ 역전파 자동화/ 재귀, 반복문/ 파이썬 함수 활용

In [1]: import numpy as np 6. 수동 역전파¶ 이전 단계에서 역전파의 구동원리를 설명함 이번 단계에서는 Variable과 Function 클래스를 확장하여 역전파를 이용한 미분을 구현함 6.1 Variable 클래스 추가 구현¶ 역전파에 대응하는 Variable 클래스를 구현함 이를 위해 통상값(data)과 더불어 그에 대응하는 미분값(grad)도 저장하도록 확장함 새로 추가된 코드에는 음영을 덧씌움 In [2]: class Variable: def __init__(self, data): self.data = data self.grad = None 위와 같이 새로 grad라는 인스턴스 변수를 추가함 인스턴스 변수인 data와 grad는 모두 numpy의 다차원배열(ndarray)이라..

1. Auto Gradient(자동미분): 변수/ 함수/ 수치미분/ 역전파

DeZero¶ 해당 내용의 오리지널 프레임워크 해당 내용은 DeZero를 60단계로 나누어, 조금씩 완성하도록 구성함 1.1 Variable?¶ - 상자에 데이터를 넣는 그림에서, 상자의 역할이 변수 - 상자와 데이터는 별개 - 상자에는 데이터가 들어감(대입 or 할당) - 상자 속을 들여다보면 데이터를 알 수 있음(참조) 1.2 Variable class 구현¶ - 파이썬에서는 클래스의 첫 글자 이름을 보통 대문자로 함(PEP8) - Variable 클래스가 상자가 되도록 구현 In [1]: class Variable: def __init__(self, data): self.data = data 초기화 함수 __init__에 주어진 인수를 인스턴스 변수 data에 대입함. 간단한 코드지만, 이를 통해 ..

Sampling Based Inference(Forward/Rejection/Importance Sampling)

- Learn basic sampling method Understand the concep of Markov chain Monte Carlo Able to apply MCMC to the parameter inference of Bayesian networks Know the mechanism of rejection sampling Know the mechanism of importance sampling - Learn sampling based inference Understand the concept of Metropolis-Hastings algorithm Know the mechanism of Gibbs sampling Forward Sampling in GMM - Sample z from ..

Hidden Markov Model (2. For-Backward Prob. Calculation/ Viterbi Decoding Algorithm)

Detour: Dynamic Programming - Dynamic Programming A general algorithm design technique for solving problems defined by or formulated as recurrences with overlapping sub-instances In this context, Programming == Planning - Main storyline Setting up a recurrence Relating a solution of a larger instance to solutions of some smaller instances Solve small instances once Record solutions in a table Ex..

Hidden Markov Model(1: Joint, Marginal Probability of HMM)

Main Questions on HMM - Given the topology of the bayseian network, HMM, or M π는 initial state, latent state를 정의할때 쓰이는 parameter a는 어느 state에서 다음 state로 transitional 할 때의 probability b는 어떤 특정 state에서 observation이 generated 되서 나올 probability X는 우리가 가지고 있는 관측값 - 1. Evaluation question - Given π,a,b,X - Find P(X|M,π,a,b) - how much is X likely to be observed in the trained model? ..

Bayesian Network

- Graphical Model 중에서도 큰 부분을 차지하는게 bayesian network! - 베이지안 네트워크 또한 확률 변수들 사이의 관계를 표현하는 것 Bayesian Network - A graphical notation of Random variables Conditional independence To obtain a compact representation of the full joint distributions - Syntax A acyclie and directed graph (사이클이 없는 방향성이 있는 graph) A set of nodes A random variable A conditional distribution given its parents $P(X_i | Parents..

Logistic Regression + Gaussian Naive Bayes

- binomial 혹은 multinomial에 적용 가능한 확률론적 분류기(probabilitic classifier) - 로지스틱 회귀는 시그모이드의 특별한 형태 f(x)=11+ex - 로지스틱 회귀를 역함수 형태로 만들면 로짓 함수(logit function)이라 하며, 이는 f(x)=log(x1x) 로 표현함. - linear regression에서 첫 항을 더미변수 1로 놓았을 때, ^f(x)=Xθ로 표현함. 여기서, logistic regression을 위한 베르누이 분포의 pmf (우리가 궁극적으로 찾아야 할 식)는 P(y|x)=μ(x)y(1μ(x))1y 임 한편, $..

인공지능및기계학습개론 lecture2: regression 구현

구현1. linear regression¶ x의 1차항만 고려하는 선형회귀(Linear Regression) 모형 13개의 Attribute 중 첫 번째 Attribute만 Feature varaible로 활용함 (강의에서 첫 번째 항은 더미데이터처럼 1이라 한 것 기억!) ˆθ=argminθ(fˆf)2  >>θ=(XTX)1XTY y_est(= x_temp * θ): 위에서 구해진 theta로 도출된 예측치 In [1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid'..

1 2 3