Programing

생성 알고리즘과 차별 알고리즘의 차이점은 무엇입니까?

crosscheck 2020. 10. 4. 10:30
반응형

생성 알고리즘과 차별 알고리즘의 차이점은 무엇입니까?


저는 단지 초보자 일 뿐이라는 점을 염두에두고 생성 알고리즘 차별 알고리즘 의 차이점을 이해하도록 도와주세요 .


입력 데이터가 x있고 데이터를 레이블로 분류하려고 한다고 가정 해 보겠습니다 y. 생성적인 모델은 학습 의 공동 확률 분포를 p(x,y)하고 차별적 모델은 학습 조건부 확률 분포를 p(y|x)- 당신과 같이해야하는 '확률 y주어진 x" .

여기 정말 간단한 예가 있습니다. 다음과 같은 형식의 데이터가 있다고 가정합니다 (x,y).

(1,0), (1,0), (2,0), (2, 1)

p(x,y) 이다

      y=0   y=1
     -----------
x=1 | 1/2   0
x=2 | 1/4   1/4

p(y|x) 이다

      y=0   y=1
     -----------
x=1 | 1     0
x=2 | 1/2   1/2

잠시 시간을내어이 두 행렬을 살펴보면 두 확률 분포의 차이를 이해할 수 있습니다.

분포 p(y|x)는 주어진 예제 x를 클래스로 분류하기위한 자연스러운 분포 y이므로이를 직접 모델링하는 알고리즘을 판별 알고리즘이라고합니다. 생성 알고리즘 모델 p(x,y). p(y|x)Bayes 규칙을 적용하여 변환 한 다음 분류에 사용할 수 있습니다 . 그러나 배포 p(x,y)는 다른 목적으로도 사용할 수 있습니다. 예를 들어를 사용 p(x,y)하여 가능한 생성 할 수 있습니다 (x,y).

위의 설명에서 생성 모델이 더 일반적으로 유용하고 따라서 더 좋다고 생각할 수 있지만 그렇게 간단하지는 않습니다. 이 논문 은 차별적 분류와 생성 적 분류의 주제에 대한 매우 인기있는 참고 자료이지만 꽤 무겁습니다. 전체적인 요점은 차별적 모델이 일반적으로 분류 작업에서 생성 적 모델을 능가한다는 것입니다.


생식 알고리즘 모델은 데이터 신호를 분류하기 위하여 생성되다. 내 세대 가정을 기반으로이 신호를 생성 할 가능성이 가장 높은 카테고리는 무엇입니까?

차별적 알고리즘 데이터가 생성 된 방법에 대해 상관하지 않는다, 그것은 단순히 주어진 신호를 분류합니다.


당신의 임무가 언어로 연설을 분류하는 것이라고 상상해보십시오.

다음 중 하나를 수행 할 수 있습니다.

  1. 각 언어를 배우고 방금 습득 한 지식을 사용하여 분류

또는

  1. 언어를 배우지 않고 언어 모델의 차이를 결정한 다음 음성을 분류합니다.

첫 번째는 생성 적 접근 방식이고 두 번째는 차별적 접근 방식입니다.

자세한 내용은이 참조를 확인하십시오 : http://www.cedar.buffalo.edu/~srihari/CSE574/Discriminative-Generative.pdf .


실제로 모델은 다음과 같이 사용됩니다.

에서 차별적 모델 , 라벨 예측하는 y훈련 예제를 x, 당신은 평가해야합니다 :

여기에 이미지 설명 입력

단지 y고려할 가능성이 가장 높은 클래스를 선택합니다 x. 마치 클래스 간의 결정 경계모델링 하려는 것과 같습니다 . 이 동작은 계산 된 가중치가 공간에서 클래스의 요소를 분리하는 복잡한 모양의 곡선으로 볼 수있는 신경망에서 매우 분명합니다.

이제 Bayes의 규칙을 사용 여기에 이미지 설명 입력하여 방정식에서를 여기에 이미지 설명 입력. arg max에 관심이 있기 때문에 분모를 지울 수 있으며 모든 y. 그래서 당신은

여기에 이미지 설명 입력

생성 모델 에서 사용하는 방정식 입니다.

첫 번째 경우에는 클래스 간의 경계를 모델링 조건부 확률 분포 를 사용했지만 두 번째 경우에는 p (x, y) = p (x | y) p이므로 결합 확률 분포 p (x, y)를 사용했습니다. (y), 각 클래스의 실제 분포명시 적으로 모델링합니다 .p(y|x)

합동 확률 분포 함수를 사용하여을 지정하면 y각각의를 계산 ( "생성") 할 수 있습니다 x. 이러한 이유로 "생성"모델이라고합니다.


다음 은 주제와 관련된 CS299 (Andrew Ng 저) 강의 노트 에서 가장 중요한 부분입니다. 이는 차별적 학습 알고리즘 생성 적 학습 알고리즘 의 차이점을 이해하는 데 도움 됩니다 .

코끼리 ( y = 1)와 개 ( y = 0) 라는 두 종류의 동물이 있다고 가정 합니다. 그리고 x 는 동물의 특징 벡터입니다.

훈련 세트가 주어지면 로지스틱 회귀 또는 퍼셉트론 알고리즘 (기본적으로)과 같은 알고리즘은 코끼리와 개를 구분하는 직선, 즉 결정 경계를 찾으려고합니다. 그런 다음 새로운 동물을 코끼리 또는 개로 분류하기 위해 결정 경계의 어느쪽에 속하는지 확인하고 그에 따라 예측합니다. 이를 차별적 학습 알고리즘이라고 합니다.

여기에 다른 접근 방식이 있습니다. 먼저 코끼리를 보면 코끼리가 어떻게 생겼는지 모델을 만들 수 있습니다. 그런 다음 개를 보면 개가 어떻게 생겼는지에 대한 별도의 모델을 만들 수 있습니다. 마지막으로 새 동물을 분류하기 위해 새 동물을 코끼리 모델과 비교하고 개 모델과 비교하여 새 동물이 코끼리와 비슷하게 보이는지 아니면 훈련 세트에서 본 개와 더 비슷하게 보이는지 확인할 수 있습니다. . 이를 생성 학습 알고리즘이라고 합니다.


일반적으로 기계 학습 커뮤니티에는 원하지 않는 것을 배우지 않는 관행이 있습니다. 예를 들어, 주어진 x 입력에 y 레이블을 할당하는 것이 목표 인 분류 문제를 생각해보십시오. 생성 모델을 사용하면

p(x,y)=p(y|x).p(x)

we have to model p(x) which is irrelevant for the task in hand. Practical limitations like data sparseness will force us to model p(x) with some weak independence assumptions. Therefore, we intuitively use discriminative models for classification.


The different models are summed up in the table below: 여기에 이미지 설명 입력


An addition informative point that goes well with the answer by StompChicken above.

The fundamental difference between discriminative models and generative models is:

Discriminative models learn the (hard or soft) boundary between classes

Generative models model the distribution of individual classes

Edit:

A Generative model is the one that can generate data. It models both the features and the class (i.e. the complete data).

If we model P(x,y): I can use this probability distribution to generate data points - and hence all algorithms modeling P(x,y) are generative.

Eg. of generative models

  • Naive Bayes models P(c) and P(d|c) - where c is the class and d is the feature vector.

    Also, P(c,d) = P(c) * P(d|c)

    Hence, Naive Bayes in some form models, P(c,d)

  • Bayes Net

  • Markov Nets

A discriminative model is the one that can only be used to discriminate/classify the data points. You only require to model P(y|x) in such cases, (i.e. probability of class given the feature vector).

Eg. of discriminative models:

  • logistic regression

  • Neural Networks

  • Conditional random fields

In general, generative models need to model much more than the discriminative models and hence are sometimes not as effective. As a matter of fact, most (not sure if all) unsupervised learning algorithms like clustering etc can be called generative, since they model P(d) (and there are no classes:P)

PS: Part of the answer is taken from source


My two cents: Discriminative approaches highlight differences Generative approaches do not focus on differences; they try to build a model that is representative of the class. There is an overlap between the two. Ideally both approaches should be used: one will be useful to find similarities and the other will be useful to find dis-similarities.


A generative algorithm model will learn completely from the training data and will predict the response.

A discriminative algorithm job is just to classify or differentiate between the 2 outcomes.


All previous answers are great, and I'd like to plug in one more point.

From generative algorithm models, we can derive any distribution; while we can only obtain the conditional distribution P(Y|X) from the discriminative algorithm models(or we can say they are only useful for discriminating Y’s label), and that's why it is called discriminative model. The discriminative model doesn't assume that the X's are independent given the Y($X_i \perp X_{-i} | Y$) and hence is usually more powerful for calculating that conditional distribution.

참고URL : https://stackoverflow.com/questions/879432/what-is-the-difference-between-a-generative-and-a-discriminative-algorithm

반응형