본문 바로가기

카테고리 없음

[데이터마이닝] 검색엔진, 추천시스템 성능 평가 (MRR,DCG)

How will you evaluate search results or recommender system?

 

보통 머신러닝 모델 성능 평가 할때 precision,  recall, accuary 등을 사용하는데

검색 결과가 여러개 나올때 이를 쓰기에는 불편한 점이 있다. 

 

When results are multiple, you may need MRR or DCG!

MRR(mean reciprocal rank)

mean은 단순히 평균이라는 뜻이고 

Reciprocal rank는?

가장 높이 위치한 연관된 검색어에 집중한다. 연관된 검색 결과는 2번에 rank는 dogs다. 1/2라는 점수가 나오게 되어있다. puppy는 철저히 무시된다. 

 

MRR은 추천시스템을 평가할때 여러개의 query로 평가하는 것이다. 여기서는 Dog, Cat 두 개의 쿼리(검색)을 날렸다.

점수들이 나올 것이고 여기에 평균을 취한 값이 mrr 이다. 

MRR is simple evaluation, But only care about highest ranked relevant item

사용하기 간단해서 좋은데 연관된 검색어 여러개 보여준다 하더라고 가장 높은 것만 본다. 다른것들을 철저히 무시된다. 제대로 판단하고 있는건지 미심쩍은 부분이 있다.  그래서 사용하는 것이 DCG이다. 장 높은 것만 본다. 다른것들을 철저히 무시된다. 

 

가장 높은 것만 보는 것이 아니고 검색된 결과를 전반적으로 본다. 

높은 것만 보지 말고 전반적으로 rank된 모든 item들을 보자

연관된 검색어에 각각에 점수를 부여하고 그 위치에 따라서 상대적인 점수를 준다는 이야기.

예제를 보면 더 쉽다. 

똑같은 예제다. dog라고 검색을 했고 1번은 hotdog 2번은 dogs 3번은 puppy 4번은 cat

빨리 나올 수록 높은 점수를 주어야하니까.  log_2(i+1)이 분모에 들어감으로써 rank가 높으면  페널티를 주는 것이다. 

 

Normalized DCG

Search result lists vary in length depending on the query. Comparing a search engine's performance from one query to the next cannot be consistently achieved using DCG alone, so the cumulative gain at each position for a chosen value of {\displaystyle p} should be normalized across queries. This is done by sorting all relevant documents in the corpus by their relative relevance, producing the maximum possible DCG through position {\displaystyle p}, also called Ideal DCG (IDCG) through that position. For a query, the normalized discounted cumulative gain, or nDCG, is computed as:

 

where IDCG is ideal discounted cumulative gain,

and {\displaystyle REL_{p}} represents the list of relevant documents (ordered by their relevance) in the corpus up to position p.

The nDCG values for all queries can be averaged to obtain a measure of the average performance of a search engine's ranking algorithm. Note that in a perfect ranking algorithm, the {\displaystyle DCG_{p}} will be the same as the {\displaystyle IDCG_{p}} producing an nDCG of 1.0. All nDCG calculations are then relative values on the interval 0.0 to 1.0 and so are cross-query comparable.

The main difficulty encountered in using nDCG is the unavailability of an ideal ordering of results when only partial relevance feedback is available.