일래스틱서치의 phrase 쿼리에 사용할 수 있는 3가지 스무딩 모델에 대한 설명이다. 어려워서 정리해놨다.. 



아래 일래스틱서치 문서를 보면 관련 내용이 잠깐 나온다. 


https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html#_smoothing_models


Smoothing Modelsedit

The phrase suggester supports multiple smoothing models to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index).

stupid_backoff

a simple backoff model that backs off to lower order n-gram models
if the higher order count is
 0 and discounts the lower order n-gram model by a constant factor. The default discount is 0.4. Stupid Backoff is the default model.

laplace

a smoothing model that uses an additive smoothing where a constant
(typically
 1.0 or smaller) is added to all counts to balance weights, The default alpha is 0.5.

linear_interpolation

a smoothing model that takes the weighted mean of the unigrams,
bigrams and trigrams based on user supplied weights (lambdas).
Linear Interpolation doesn’t have any default values. All parameters (
trigram_lambda, bigram_lambda, unigram_lambda) must be supplied.





stupid backoff는 일래스틱서치의 phrase 제안자에서 사용되는 기본 스무딩 모델이다. 해당 스무딩 모델을 변경하거나 강제로 사용하려면 stupid_backoff라는 이름을 사용해야 한다. stupid backoff 스무딩 모델은 더 높은 차수의 n-gram 개수가 0이면 낮은 차수의 n-gram을 사용하는 구현이다(그리고 stupid_backoff는 discount 속성의 값과 동일한 할인을 제공한다). 예제를 설명하기 위해 일반적이고 제안자가 사용하는 인덱스에 존재하는 ab 바이그램(bigram)과 c 유니그램(unigram)을 사용한다고 가정한다. 그러나 abc 트라이그램(trigram)는 갖고 있지 않다. stupid backoff은 abc가 존재하지 않기 때문에 ab 바이그램을 사용할 것이고 물론 ab 바이그램 모델은 discount 속성의 값과 동일한 할인을 받게 될 것이다.



stupid backoff 모델은 discount 속성이라는 변경할 수 있는 단일 속성을 제공한다. 기본적으로 discount 값은 0.4로 설정되어 있고, 낮은 차수의 n-gram 모델의 discount 인자로 사용된다.

n-gram 스무딩 모델에 대한 자세한 내용은 http://en.wikipedia.org/wiki/N-gram#Smoothing_techniques와 http://en.wikipedia.org/wiki/Katz's_back-off_model(설명한 stupid backoff 모델과 비슷하다)을 통해 더 살펴볼 수 있다.



라플라스(laplace)는 부가적인 스무딩 모델이라 불린다. 라플라스가 사용될 때(라플라스를 사용하려면 laplace 값을 사용해야 한다), alpha 매개 변수의 값과 동일한 상수값(기본값은 0.5 이다)은 빈번하고 자주 발생하지 않는 가중치의 균형을 유지하기 위해 개수에 추가된다. 언급한 것처럼 라플라스는 기본값이 0.5인 alpha 매개 변수를 사용해 설정할 수 있다. 일반적으로 alpha 매개 변수의 일반적인 값은 1.0이하이다.

부가적 스무딩에 대한 자세한 내용은 http://en.wikipedia.org/wiki/Additive_smoothing을 참조한다.



Posted by '김용환'
,