The Three Decoding Methods For NLP -번역

NLP를위한 세 가지 디코딩 방법

탐욕에서 빔 검색으로

Photo by Jesse Collins on Unsplash

영형자연어 처리 (NLP)에서 시퀀스 생성에서 자주 간과되는 부분 중 하나는 출력 토큰을 선택하는 방법입니다.디코딩.

당신은 생각할 수 있습니다-우리는 우리 모델에 의해 할당 된 각 토큰의 확률에 따라 토큰 / 단어 / 문자를 선택합니다.

이것은절반-true — 언어 기반 작업에서 일반적으로 확률 집합을 배열에 출력하는 모델을 구축합니다. 여기서 배열의 각 값은 특정 단어 / 토큰의 확률을 나타냅니다.

이 시점에서 migh확률이 가장 높은 토큰을 선택하는 것이 논리적으로 보입니까?글쎄요, 사실은 아닙니다. 이것은 우리가 곧 보게 될 예상치 못한 결과를 초래할 수 있습니다.

기계 생성 텍스트에서 토큰을 선택할 때이 디코딩을 수행하는 몇 가지 대체 방법과 정확한 동작을 수정하는 옵션도 있습니다.

이 기사에서는 출력 토큰을 선택하는 세 가지 방법을 살펴 보겠습니다.

& gt;탐욕스러운 디코딩& gt;랜덤 샘플링& gt;빔 검색

이러한 각각의 작동 방식을 이해하는 것은 매우 중요합니다. 종종 언어 응용 프로그램에서 출력 불량에 대한 해결책은이 네 가지 방법 사이의 간단한 전환이 될 수 있습니다.

비디오를 선호하는 경우 여기에서 세 가지 방법을 모두 다룹니다.

이러한 각 방법을 테스트 할 수 있도록 노트북을 포함했습니다.여기에 GPT-2.

탐욕스러운 디코딩

우리가 가진 가장 간단한 옵션은 탐욕스러운 디코딩입니다.이것은 우리의 잠재적 출력 목록과 이미 계산 된 확률 분포를 가져 와서 가장 높은 확률 (argmax)을 가진 옵션을 선택합니다.

이것은 완전히 논리적 인 것처럼 보이며 대부분의 경우 완벽하게 잘 작동합니다.그러나 더 긴 시퀀스의 경우 이로 인해 몇 가지 문제가 발생할 수 있습니다.

다음과 같은 출력을 본 적이 있다면 :

기본 텍스트는 우리가 모델에 공급 한 것입니다. 녹색 텍스트가 생성되었습니다.

이것은 탐욕스러운 디코딩 방법이 특정 단어 또는 문장에 붙어 있고 이러한 단어 세트에 반복적으로 가장 높은 확률을 반복적으로 할당하기 때문일 가능성이 큽니다.

랜덤 샘플링

다음 옵션은 무작위 샘플링입니다.우리가 잠재적 인 산출물과 확률 분포를 얻기 전과 매우 유사합니다.

무작위 샘플링은 이러한 확률을 기반으로 다음 단어를 선택합니다. 따라서이 예에서는 다음과 같은 단어와 확률 분포가있을 수 있습니다.

무작위 샘플링을 사용하면 모델에서 이전에 할당 한 확률을 기반으로 단어를 무작위로 선택할 수 있습니다.

모델이 ‘영향력’을 선택할 확률은 48 %이고, ‘위대한’을 선택할 확률은 21 %입니다.

이것은 예측에 무작위성을 추가하기 때문에 같은 단어의 반복되는 루프에 갇히는 문제를 해결합니다.

그러나 이로 인해 다른 문제가 발생합니다. 이러한 접근 방식이 너무 무작위적이고 일관성이 부족할 수 있습니다.

그래서 한쪽에는탐욕스러운 검색텍스트를 생성하기에는 너무 엄격합니다. 다른 한편으로는무작위 샘플링멋진 횡설수설을 생성합니다.

우리는 두 가지 모두를 수행하는 무언가를 찾아야합니다.

빔 검색

빔 검색을 사용하면 최상의 옵션을 선택하기 전에 여러 수준의 출력을 탐색 할 수 있습니다.

빔 검색, 전체적으로 ‘연습, 그는’다른 잠재적 경로보다 높은 점수를 얻었습니다.

따라서 탐욕스러운 디코딩과 무작위 샘플링은 바로 다음 단어 / 토큰만을 기반으로 최상의 옵션을 계산하는 반면 빔 검색은 미래의 여러 단어 / 토큰을 확인하고 결합 된 모든 토큰의 품질을 평가합니다.

이 검색에서 여러 잠재적 인 출력 시퀀스를 반환합니다. 고려하는 옵션의 수는 검색 할 때 사용하는 ‘빔’의 수입니다.

그러나 이제 순서를 순위 지정하고 가장 가능성이 높은 순서를 선택하기 때문에 빔 검색으로 인해 텍스트 생성이 다시 반복되는 순서로 저하 될 수 있습니다.

따라서이를 방지하기 위해 디코딩을 늘립니다.온도— 출력의 임의성 정도를 제어합니다.기본값온도이다1.0—이 값을 약간 더 높은 값으로1.2큰 차이를 만듭니다.

이러한 수정으로 우리는 독특하지만 그럼에도 불구하고 일관된 결과를 얻었습니다.

이것으로 텍스트 생성 디코딩 방법에 대한 요약입니다!

기사를 즐겁게 읽으 셨기를 바랍니다. 질문이나 제안 사항이 있으면 알려주세요.트위터또는 아래 의견에.

읽어 주셔서 감사합니다!

Python에서 텍스트 생성 모델을 설정하는 방법에 관심이 있다면 여기에서 방법을 다루는이 짧은 기사를 작성했습니다.

* 달리 명시된 경우를 제외하고 모든 이미지는 작성자의 것입니다.

The Three Decoding Methods For NLP

The Three Decoding Methods For NLP

From greedy to beam search

Photo by Jesse Collins on Unsplash

One of the often-overlooked parts of sequence generation in natural language processing (NLP) is how we select our output tokens — otherwise known as decoding.

You may be thinking — we select a token/word/character based on the probability of each token assigned by our model.

This is half-true — in language-based tasks, we typically build a model which outputs a set of probabilities to an array where each value in that array represents the probability of a specific word/token.

At this point, it might seem logical to select the token with the highest probability? Well, not really — this can create some unforeseen consequences — as we will see soon.

When we are selecting a token in machine-generated text, we have a few alternative methods for performing this decode — and options for modifying the exact behavior too.

In this article we will explore three different methods for selecting our output token, these are:

> Greedy Decoding> Random Sampling> Beam Search

It’s pretty important to understand how each of these works — often-times in language applications, the solution to a poor output can be a simple switch between these four methods.

If you’d prefer video, I cover all three methods here too:

I’ve included a notebook for testing each of these methods with GPT-2 here.

Greedy Decoding

The simplest option we have is greedy decoding. This takes our list of potential outputs and the probability distribution already calculated — and chooses the option with the highest probability (argmax).

It would seem that this is entirely logical — and in many cases, it works perfectly well. However, for longer sequences, this can cause some problems.

If you have ever seen an output like this:

The default text is what we fed into the model — the green text has been generated.

This is most likely due to the greedy decoding method getting stuck on a particular word or sentence and repetitively assigning these sets of words the highest probability again and again.

Random Sampling

The next option we have is random sampling. Much like before we have our potential outputs and their probability distribution.

Random sampling chooses the next word based on these probabilities — so in our example, we might have the following words and probability distribution:

Random sampling allows us to randomly choose a word based on its probability previously assigned by the model

We would have a 48% chance of the model selecting ‘influence’, a 21% chance of it choosing ‘great’, and so on.

This solves our problem of getting stuck in a repeating loop of the same words because we add randomness to our predictions.

However, this introduces a different problem — we will often find that this approach can be too random and lacks coherence:

So on one side, we have greedy search which is too strict for generating text — on the other we have random sampling which produces wonderful gibberish.

We need to find something that does a little of both.

Beam Search

Beam search allows us to explore multiple levels of our output before selecting the best option.

Beam search, as a whole the ‘practice, he had’ scored higher than any other potential path

So whereas greedy decoding and random sampling calculate the best option based on the very next word/token only — beam search checks for multiple word/tokens into the future and assesses the quality of all of these tokens combined.

From this search, we will return multiple potential output sequences — the number of options we consider is the number of ‘beams’ we search with.

However, because we are now back to ranking sequences and selecting the most probable — beam search can cause our text generation to again degrade into repetitive sequences:

So, to counteract this, we increase the decoding temperature — which controls the amount of randomness in the outputs. The default temperature is 1.0 — pushing this to a slightly higher value of 1.2 makes a huge difference:

With these modifications, we have a peculiar but nonetheless coherent output.

That’s it for this summary of text generation decoding methods!

I hope you’ve enjoyed the article, let me know if you have any questions or suggestions via Twitter or in the comments below.

Thanks for reading!

If you’re interested in learning how to set up a text generation model in Python, I wrote this short article covering how here:

*All images are by the author except where stated otherwise

2021년 2월 25일 성남시 분당구 부동산 경매 데이터 분석

2021년 2월 25일 용인시 부동산 경매 데이터 분석

경기도 용인시 기흥구 죽전로 20, 7층104동702호 (보정동,죽전누리에뜰) [집합건물 철근콘크리트조 123.18㎡]

항목
경매번호 2020타경56072,2020타경62565(중복)
경매날짜 2021.03.11
법원 수원지방법원
담당 경매14계
감정평가금액 495,000,000
경매가 495,000,000(100%)
유찰여부 신건


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층228호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51695
경매날짜 2021.03.11
법원 수원지방법원
담당 경매14계
감정평가금액 63,000,000
경매가 15,126,000(24%)
유찰여부 유찰\t4회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층237호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51695
경매날짜 2021.03.11
법원 수원지방법원
담당 경매14계
감정평가금액 65,000,000
경매가 15,607,000(24%)
유찰여부 유찰\t4회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

2021년 2월 25일 수원시 부동산 경매 데이터 분석

경기도 수원시 장안구 경수대로976번길 22, 148동 22층2202호 (조원동,수원한일아파트) [집합건물 철근콘크리트 벽식구조 59.842㎡]

항목
경매번호 2020타경4293,2019타경523873(중복)
경매날짜 2021.03.11
법원 수원지방법원
담당 경매14계
감정평가금액 285,000,000
경매가 285,000,000(100%)
유찰여부 신건


<최근 1년 실거래가 정보>
– 총 거래 수: 268건
– 동일 평수 거래 수: 108건

최근 1년 동일 평수 거래건 보기

날짜 전용면적 가격
2021-02-02 59.962 4 40000
2021-01-14 59.842 13 42900
2021-01-22 59.842 1 33500
2021-01-27 59.842 7 42000
2021-01-29 59.962 2 35000
2021-01-13 59.842 10 39500
2021-01-13 59.842 13 42750
2021-01-14 59.962 1 37500
2021-01-26 59.962 22 40000
2021-01-28 59.962 10 43000
2021-01-29 59.962 17 42000
2021-01-03 59.842 19 39000
2021-01-09 59.842 13 39000
2021-01-17 59.962 22 43000
2021-01-08 59.962 22 41800
2020-12-12 59.842 20 39800
2020-12-18 59.962 2 35000
2020-12-26 59.842 10 41000
2020-12-12 59.962 7 39500
2020-12-13 59.842 16 38350
2020-12-17 59.962 12 36000
2020-12-04 59.962 5 38000
2020-12-05 59.842 14 39500
2020-12-19 59.962 1 37500
2020-11-20 59.962 16 41000
2020-11-21 59.842 22 37500
2020-11-05 59.842 2 36700
2020-11-26 59.842 7 38000
2020-11-28 59.842 12 40000
2020-11-28 59.962 6 37900
2020-11-20 59.962 17 40500
2020-11-28 59.962 13 40800
2020-10-10 59.842 5 38700
2020-10-14 59.842 5 35800
2020-10-17 59.842 16 37500
2020-10-24 59.842 12 38000
2020-10-12 59.962 14 38500
2020-10-21 59.962 9 39000
2020-10-23 59.842 17 38800
2020-10-24 59.842 2 37000
2020-10-26 59.842 22 38000
2020-10-28 59.962 16 39800
2020-10-07 59.962 8 38300
2020-10-09 59.962 13 37800
2020-09-05 59.842 11 37500
2020-09-15 59.842 14 37500
2020-09-20 59.962 20 39000
2020-09-21 59.842 14 37200
2020-09-24 59.842 16 36900
2020-09-30 59.842 12 37000
2020-09-16 59.962 14 41000
2020-08-21 59.842 21 39550
2020-08-13 59.962 20 38500
2020-08-16 59.962 2 36800
2020-07-02 59.962 3 35200
2020-07-02 59.842 2 33000
2020-07-23 59.962 15 38000
2020-07-04 59.962 17 37900
2020-07-05 59.842 13 37450
2020-07-18 59.962 3 36800
2020-06-18 59.962 21 34900
2020-06-06 59.842 18 38000
2020-06-01 59.842 6 35000
2020-06-13 59.962 6 37900
2020-06-17 59.962 7 35000
2020-06-18 59.842 19 35000
2020-06-20 59.842 12 36500
2020-06-24 59.962 7 39000
2020-06-26 59.842 6 35000
2020-06-05 59.842 10 35500
2020-06-06 59.962 9 35900
2020-06-17 59.962 4 37400
2020-05-13 59.842 20 38000
2020-05-18 59.842 3 33500
2020-05-20 59.962 11 38000
2020-05-23 59.842 7 35400
2020-05-26 59.842 10 36500
2020-05-30 59.962 18 34900
2020-04-10 59.962 17 35000
2020-04-10 59.842 12 35000
2020-04-20 59.842 4 32000
2020-04-11 59.842 6 36500
2020-04-11 59.842 18 36000
2020-03-02 59.962 6 39000
2020-03-22 59.962 18 37000
2020-03-12 59.842 13 35500
2020-03-13 59.842 22 36500
2020-03-18 59.962 7 35700
2020-02-01 59.962 1 27500
2020-02-13 59.842 12 28000
2020-02-18 59.842 1 29000
2020-02-27 59.842 7 28000
2020-02-05 59.842 16 28900
2020-02-09 59.842 3 28400
2020-02-01 59.962 10 33400
2020-02-01 59.842 20 32000
2020-02-01 59.842 3 29000
2020-02-10 59.842 17 32000
2020-02-11 59.842 15 33800
2020-02-12 59.962 16 33000
2020-02-15 59.842 15 34000
2020-02-18 59.962 21 36400
2020-02-02 59.962 1 27500
2020-02-20 59.962 10 37000
2020-02-29 59.842 3 33000
2020-02-29 59.842 23 32250
2020-02-29 59.842 23 32250
2020-02-07 59.842 9 33000

2021년 2월 24일 모바일 게임 매출 순위

Rank Game Publisher
1 리니지M NCSOFT
2 리니지2M NCSOFT
3 그랑사가 NPIXEL
4 기적의 검 4399 KOREA
5 Cookie Run: Kingdom – Kingdom Builder & Battle RPG Devsisters Corporation
6 세븐나이츠2 Netmarble
7 라이즈 오브 킹덤즈 LilithGames
8 Genshin Impact miHoYo Limited
9 바람의나라: 연 NEXON Company
10 미르4 Wemade Co., Ltd
11 Roblox Roblox Corporation
12 Brawl Stars Supercell
13 A3: 스틸얼라이브 Netmarble
14 V4 NEXON Company
15 S.O.S:스테이트 오브 서바이벌 KingsGroup Holdings
16 뮤 아크엔젤 Webzen Inc.
17 메이플스토리M NEXON Company
18 R2M Webzen Inc.
19 블레이드&소울 레볼루션 Netmarble
20 KartRider Rush+ NEXON Company
21 찐삼국 ICEBIRD GAMES
22 카운터사이드 NEXON Company
23 FIFA ONLINE 4 M by EA SPORTS™ NEXON Company
24 Pokémon GO Niantic, Inc.
25 PUBG MOBILE KRAFTON, Inc.
26 리니지2 레볼루션 Netmarble
27 라그나로크 오리진 GRAVITY Co., Ltd.
28 검은강호2: 이터널 소울 9SplayDeveloper
29 Lords Mobile: Kingdom Wars IGG.COM
30 Cookie Run: OvenBreak – Endless Running Platformer Devsisters Corporation
31 Epic Seven Smilegate Megaport
32 가디언 테일즈 Kakao Games Corp.
33 랑그릿사 ZlongGames
34 Empires & Puzzles: Epic Match 3 Small Giant Games
35 Homescapes Playrix
36 Top War: Battle Game Topwar Studio
37 사신키우기 온라인 : 갓 사신 DAERISOFT
38 Age of Z Origins Camel Games Limited
39 어비스(ABYSS) StairGames Inc.
40 Pmang Poker : Casino Royal NEOWIZ corp
41 Gardenscapes Playrix
42 한게임 포커 NHN BIGFOOT
43 갑부: 장사의 시대 BLANCOZONE NETWORK KOREA
44 AFK 아레나 LilithGames
45 블리치: 만해의 길 DAMO NETWORK LIMITED
46 그랑삼국 YOUZU(SINGAPORE)PTE.LTD.
47 FIFA Mobile NEXON Company
48 슬램덩크 DeNA HONG KONG LIMITED
49 검은사막 모바일 PEARL ABYSS
50 붕괴3rd miHoYo Limited

The Gambler’s Ruin Problem -번역

도박꾼의 파멸 문제

마르코프 체인의 독특한 응용

Image for post

Photo by Jonathan Petersson on Unsplash

Introduction

조건부 확률 이론은 종종 특정 수학적 문제에 대한 독특하고 흥미로운 솔루션으로 이어집니다.복잡한 확률 문제를 비교적 간단하게 해결할 수있을 때 흥분과 불신이 섞여 있습니다.조건부 확률과 실험 결과를 중심으로 한 유명한 통계 시나리오 인 Gambler ‘s Ruin Problem의 경우는 확실히 해당됩니다.이 문제에 대해 훨씬 더 매력적인 것은 그 구조가 조건부 확률을 넘어 무작위 변수 및 분포로 확장된다는 것입니다. 특히 흥미로운 특성을 가진 고유 한 마르코프 체인의 적용으로 확장됩니다.

초등학교강도 문제는 불확실한 결과에 대한 수학적 설명을 기반으로합니다.초등학교 통계는 복잡한 시나리오를 이해하고 정리를 사용하여 불확실한 결과의 확률을 결정하는 데 사용할 수있는 도구 세트를 제공합니다.도박꾼의 파멸 문제를 해결하는 것은 우리가 매일해야하는 일이 아니지만, 그 구조를 이해하면 불확실성에 뿌리를 둔 상황에 접근 할 때 비판적이고 수학적 사고 방식을 개발하는 데 도움이됩니다.

ote :이 게시물은 독자가 미적분과 선형 대수에 대한 노출을 필요로하는 기초 확률과 통계 이론을 이해해야합니다.또한 독자가 Markov 체인에 대한 몇 가지 기본 지식을 가지고 있다고 가정합니다.

문제 설명

가장 기본적인 형태의 Gambler ‘s Ruin Problem은 두 명의 도박꾼으로 구성됩니다.확률 론적 게임을 여러 번하고 있습니다.게임을 할 때마다 확률이 있습니다(0 & lt;& lt;1) 그 도박꾼도박꾼에게 이길 것이다.마찬가지로 기본 확률 공리를 사용하여 도박꾼이이길 것입니다 1-피.각 도박꾼은 또한 베팅 할 수있는 금액을 제한하는 초기 자산을 가지고 있습니다.총 결합 부는 다음과 같이 표시됩니다.케이그리고 도박꾼초기 재산은나는, 이는 도박꾼이초기 재산이k-나. 부는 긍정적이어야합니다.이 문제에 적용하는 마지막 조건은 두 도박꾼이 둘 중 한 명이 초기 재산을 모두 잃어 더 이상 플레이 할 수 없을 때까지 무기한 플레이한다는 것입니다.

그 도박꾼을 상상해보십시오의 초기 재산나는정수 달러 금액이며 각 게임은 1 달러로 진행됩니다.그건 도박꾼이적어도 플레이해야 할 것입니다나는그들의 부를 0으로 떨어 뜨리는 게임.그들이 각 게임에서 1 달러를 이길 확률은, 게임이 두 도박꾼 모두에게 공평하다면 1/2이됩니다.만약& gt;1/2, 도박꾼체계적인 이점이 있고& lt;1/2 이후 도박꾼체계적인 단점이 있습니다.일련의 게임은 두 가지 결과로만 끝날 수 있습니다. 도박꾼풍부한케이달러 (도박꾼모든 돈을 잃었습니다) 또는 도박꾼0 달러의 부 (도박꾼모든 부가 있습니다).분석의 주요 초점은 도박꾼이풍부한으로 끝날 것입니다케이0 달러 대신 달러.결과에 관계없이 도박꾼 중 한 명이 재정적으로파멸, 따라서 이름도박꾼의 폐허.

문제 해결책

위에서 설명한 동일한 구조를 계속 사용하여 이제 확률을 결정하려고합니다.aᵢ그 도박꾼끝날 것이다케이그들이 시작한 것을 감안할 때 달러나는불화.단순함을 위해 여기에 추가 가정을 추가하겠습니다. 모든 게임은 동일하고 독립적입니다.도박꾼이 새로운 게임을 할 때마다 가장 최근 게임의 결과에 따라 각 도박꾼의 초기 재산이 다른 Gambler ‘s Ruin 문제의 새로운 반복으로 해석 될 수 있습니다.수학적으로 우리는 도박꾼으로 끝나는 게임의 각 순서를 생각할 수 있습니다.갖는제이어디 달러제이= 0,…,케이.확률 도박꾼특정 시퀀스가 발생하면 승리합니다.aⱼ.도박꾼으로 끝나는 모든 시퀀스갖는케이달러는 그들이 이겼 음을 의미하므로aₖ= 1.마찬가지로 도박꾼으로 끝나는 모든 시퀀스0 달러는 그들이 파멸에 빠졌다는 것을 의미하므로₀ = 0.우리는 모든 값에 대한 확률을 결정하는 데 관심이 있습니다.i = 1,…, k-1.

이벤트 표기법을 사용하여₁ 도박꾼이게임 1에서 승리합니다.₁은 도박꾼이게임 1에서 승리합니다. 이벤트W도박꾼이결국케이0 달러로 끝나기 전에 달러.이 이벤트가 발생할 확률은 조건부 확률의 속성을 사용하여 도출 할 수 있습니다.

조건부 확률을 사용한 승리 확률

그 도박꾼을 감안할 때로 시작나는그들이 이길 확률은P (W) = aᵢ.도박꾼이라면첫 번째 게임에서 1 달러를 획득하면 재산이i +1. 첫 게임에서 1 달러를 잃으면 재산은나는-1. 전체 시퀀스에서 이길 확률은 첫 번째 게임에서 이겼는지 여부에 따라 달라집니다.이 논리를 이전 방정식에 적용하면 게임마다 1 달러를 이길 확률과 도박꾼의 재산이 주어진 시퀀스에서 이길 조건부 확률에 의존하는 전체 게임 시퀀스에서 이길 확률의 표현을 알 수 있습니다.

문제 표기법을 사용한 승리 확률

도박꾼의 부주어진 시점에서 도박꾼의 총 초기 자산과 0 사이에 차이가 있습니다.즉, 주어진i =1, … ,k-1, 우리는 모든 가능한 값을 연결할 수 있습니다나는구하기 위해 위의 방정식에k-인접한 값을 기반으로 승리 확률을 결정하는 1 방정식나는.기초 대수를 사용하여 이러한 방정식을 단일 공식으로 단순화 할 수있는 표준화 된 형식으로 집계 할 수 있습니다.이 공식은 각 게임에서 승리 할 확률 간의 근본적인 관계를 지정합니다., 두 도박꾼의 총 초기 자산케이, 그리고 1 달러의 재산이 주어질 때 이길 확률₁.일단 우리가 결정하면₁, 우리는 모든 것을 반복적으로 반복 할 수 있습니다.k-확률을 도출하려면 1aᵢ가능한 모든 값에 대해나는.

Fundamental relation

이제 우리는 두 가지 가능성을 고려할 것입니다 : 공정한 게임과 불공정 한 게임,위의 방정식에 연결합니다.공정한 게임에서= 1 / 2, 방정식의 오른쪽에있는 지수의 밑은 (1-) /= 1.그런 다음 전체 방정식을 다음과 같이 단순화 할 수 있습니다. 1-₁ = (케이– 1)₁, 재정렬 가능₁ = 1 /케이.다른 값에 대한 승리 확률을 결정하는 모든 이전 방정식을 반복하면나는,공정한 게임을위한 일반적인 해결책에 도달했습니다.

공정한 게임을위한 솔루션

위의 방정식은 놀라운 결과입니다. 게임이 공정하다는 점을 감안할 때 도박꾼이끝날 것이다케이0 달러로 끝나기 전의 달러는 초기 자산과 같습니다.나는두 도박꾼의 총 재산으로 나눈케이.

만약두 명의 도박꾼 중 한 명이 체계적인 이점을 가지고 있기 때문에 게임이 불공평합니다.우리는 유사하게 가치에 의존하는 일반적인 해결책을 도출 할 수 있습니다.그리고 부 매개 변수.

불공정 한 게임에 대한 해결책

노트: 독자가 일반적인 솔루션에 도달하기 위해 수학적 증명을 배우는 데 관심이 있다면 마지막에있는 참고 문헌을 참조하십시오.

마르코프 체인

Image for post

~의 사진Karine Avetisyan의 위에Unsplash

랜덤 변수의 시퀀스엑스이산 시간 간격에 의해 정의 된 다른 시점을 나타내는 것은 확률 적 프로세스라고 할 수 있습니다.프로세스의 첫 번째 랜덤 변수는초기 상태,프로세스의 나머지 랜덤 변수는 시간에 각 프로세스의 상태를 정의합니다..마르코프 체인은 미래 상태의 조건부 분포가 현재 상태에만 의존하는 특정 종류의 확률 적 프로세스입니다.즉, 조건부 분포엑스시간에n + j…에 대한j & gt;0시간의 프로세스 상태에만 의존, 이전 상태가 아닌– 1.다음 표기법을 사용하여이를 수학적으로 표현할 수 있습니다.

마르코프 사슬

마르코프 사슬은한정된특정 시점에 발생할 수있는 상태 수가 무한이 아닌 경우체인을 고려하십시오케이상태.시간에서의 상태 확률 분포n + 1특정 값을 취하는제이당시의 상태로로 알려져 있습니다전환 분포마르코프 사슬의.분포가 매번 동일한 경우 이러한 분포는 고정 된 것으로 간주됩니다..표기법을 사용할 수 있습니다.pᵢⱼ이러한 분포를 나타냅니다.

고정 전이 분포

서로 다른 값의 총 수pᵢⱼ가능한 상태의 총 수에 따라 걸릴 수 있습니다.케이, 우리는케이으로케이매트릭스마르코프 사슬의 전이 행렬로 알려져 있습니다.

전환 매트릭스

전이 행렬에는 고유하게 만드는 중요한 속성이 있습니다.행렬의 모든 요소는 확률을 나타내므로 모든 요소는 양수입니다.각 행은 이전 상태의 값이 주어 졌을 때 다음 상태의 전체 조건부 분포를 나타내므로 각 행의 값은 1이됩니다. 전이 행렬을 사용하여 확률 계산을 간단한 방법으로 여러 단계로 확장 할 수 있습니다.즉, 우리는 Markov 체인이 상태에서 이동할 확률을 계산할 수 있습니다.나는상태로제이여러 단계로미디엄전환 매트릭스를 취함으로써의 힘에미디엄.즉,m 단계 전이 행렬 ᵐ는 체인의 모든 단계 범위 사이에서 특정 상태의 확률을 계산하는 데 사용할 수 있습니다.

대각선이있는 전이 행렬이있는 경우pᵢᵢ1과 같으면 상태나는간주됩니다흡수 상태.마르코프 사슬이 흡수 상태가되면 그 후에는 다른 상태로 들어갈 수 없습니다.또 다른 흥미로운 특성은 Markov 체인에 하나 이상의 흡수 상태가있는 경우 체인이 결국 이러한 상태 중 하나로 흡수된다는 것입니다.

시간 1에서 Markov 체인의 시작 부분에서 요소가 체인이 각 상태에있을 확률을 나타내는 벡터를 지정할 수 있습니다.이것은초기 확률 벡터V. We can determine the marginal distribution of the chain at any time 초기 확률 벡터를 곱하여V전환 매트릭스에 의해의 힘에-1. 예를 들어, 우리는 다음 식으로 시간 2에서 체인의 한계 분포를 찾을 수 있습니다.vP.

A special case occurs when a probability vector multiplied by the transition matrix is equal to itself: vP=V.이것이 발생하면 확률 벡터를고정 분포마르코프 체인을 위해.

도박꾼의 폐허 마르코프 사슬

Markov 체인의 이론적 프레임 워크를 사용하여 이제 이러한 개념을 Gambler ‘s Ruin 문제에 적용 할 수 있습니다.우리가 이것을 할 수 있다는 사실은 확률과 통계 이론이 얼마나 얽혀 있는지 보여줍니다.처음에는 기본 확률 공리에서 파생 된 조건부 확률 정리만을 사용하여 문제를 구성했습니다.이제 문제를 더욱 공식화하고 Markov 체인을 사용하여 더 많은 구조를 제공 할 수 있습니다.추상적 개념을 취하고 다양한 도구를 사용하여 분석하고 확장하는 과정은 통계의 마법을 강조합니다.

갬블러의 파멸 문제는 본질적으로 갬블러가A 어떤 시점에서든 기본 구조를 결정합니다.즉, 언제든지, 도박꾼가질 수있다i wealth, where i 또한 시간의 체인 상태를 나타냅니다.. When the gambler reaches either 0 wealth or k 부, 체인은 흡수 상태로 이동하고 더 이상 게임을하지 않습니다.

If the chain moves into any of the remaining k – 1 states 1, … , k – 1, a game is played again where the probability that gambler 이길거야determines the marginal distribution of the state at that specific point in time. The transition matrix has two absorbing states. The first row corresponds to the scenario when gambler has 0 wealth and the elements of the row are (1, 0, … , 0). Likewise, the last row of the transition matrix corresponds to the scenario when gambler has reached 케이부와 요소는 (0,…, 1)입니다.다른 모든 행에 대해i, 요소는 좌표가있는 항에 대해 모두 0입니다.i – 1 and i + 1, which have values 1 – p and respectively.

Gambler’s Ruin transition matrix

We can also determine the probabilities of states in multiple steps using the m-step transition matrix Pᵐ. As 미디엄goes to infinity, the m-step matrix converges but the stationary distributions are not unique. The limit matrix of ᵐ에는 첫 번째 및 마지막 열을 제외하고 모두 0이 있습니다.마지막 열에는 모든 확률이 포함됩니다.aᵢ that gambler A 끝날 것이다케이그들이 시작한 것을 감안할 때 달러i dollars, while the first column contains all the respective complements of aᵢ.Since the stationary distributions are not unique, that means that all of the probabilities belong to the absorbing states.

Gambler’s Ruin limit matrix

This last point is especially important because it confirms our initial logical sequence of steps when deriving the solution formulas to the Gambler’s Ruin. In other words, we are able to derive a general formula for the problem as a whole because the stochastic processes (sequence of games) that occur in the problem converge to one of two absorbing states: gambler A 멀리 걸어케이dollars or gamblerwalks away with 0 dollars. 무한히 많은 게임을 할 수 있지만 Markov 체인의 전이 행렬이 두 고정 분포로 수렴하기 때문에이 두 이벤트 중 하나가 발생할 확률을 결정할 수 있습니다.

결론

The Gambler’s Ruin Problem is a great example of how you can take a complex situation and derive a simple general structure from it using statistical tools. It might be difficult to believe that, given a fair game, the probability that someone will win enough games to claim the total wealth of both players is determined by their initial wealth and the total wealth. This is known not only at the beginning of the sequence, but also at each step. Using Markov chains, we can determine the same probabilities between any sequences of games using the transition matrix and the probability vector at the initial state. Consider this, the conclusion that we came to in the first section of this post was enhanced by use of an additional concept. Applying different perspectives to the same problem can open the door to insightful analysis. This is the power of theoretical statistical thinking.

참고 문헌

[1] M. H. Degroot 및 M. J. Schervish,Probability and Statistics (2018), Pearson

The Gambler’s Ruin Problem

The Gambler’s Ruin Problem

A unique application of Markov chains

Image for post

Photo by Jonathan Petersson on Unsplash

Introduction

Conditional probability theory often leads to unique and interesting solutions to certain mathematical problems. There is a mix of excitement and disbelief when a complex probabilistic problem can be solved in a relatively simply manner. This is certainly the case with the Gambler’s Ruin Problem, a famous statistical scenario centered around conditional probabilities and experimental outcomes. What is possibly even more fascinating about this problem is that its structure extends beyond conditional probability into random variables and distributions, particularly as an application of unique Markov chains with interesting properties.

Elementary probability problems are based on mathematical descriptions of uncertain outcomes. Elementary statistics gives us a set of tools that we can use to determine probabilities of uncertain outcomes using theorems as well as demystifying complex scenarios. Solving the Gambler’s Ruin Problem is not a task that we must do on a daily basis, but understanding its structure helps us develop a critical and mathematical mindset when approaching situations rooted in uncertainty.

Note: This post requires that the reader understands elementary probability and statistical theory, which itself requires exposure to both calculus and linear algebra. It is also assumed that the reader has some basic knowledge on Markov chains.

Problem Statement

The Gambler’s Ruin Problem in its most basic form consists of two gamblers A and B who are playing a probabilistic game multiple times against each other. Every time the game is played, there is a probability p (0 < p < 1) that gambler A will win against gambler B. Likewise, using basic probability axioms, the probability that gambler B will win is 1 – p. Each gambler also has an initial wealth that limits how much they can bet. The total combined wealth is denoted by k and gambler A has an initial wealth denoted by i, which implies that gambler B has an initial wealth of k – i. Wealth is required to be positive. The last condition we apply to this problem is that both gamblers will play indefinitely until one of them has lost all their initial wealth and thus cannot play anymore.

Imagine that gambler A’s initial wealth i is an integer dollar amount and that each game is played for one dollar. That means that gambler A will have to play at least i games for their wealth to drop to zero. The probability that they win one dollar in each game is p, which will be equal to 1/2 if the game is fair for both gamblers. If p > 1/2, then gambler A has a systematic advantage and if p < 1/2 then gambler A has a systematic disadvantage. The series of games can only end in two outcomes: gambler A has a wealth of k dollars (gambler B lost all their money), or gambler A has a wealth of 0 dollars (gambler B has all the wealth). The main focus of the analysis is to determine the probability that gambler A will end up with a wealth of k dollars instead of 0 dollars. Regardless of the outcome, one of the gamblers will end up in financial ruin, hence the name Gambler’s Ruin.

Problem Solution

Continuing with the same structure outlined above, we now want to determine the probability aᵢ that gambler A will end up with k dollars given that they started out with i dollars. For the sake of simplicity, we will add an additional assumption here: all games are identical and independent. Every time the gamblers play a new game, it can be interpreted as a new iteration of the Gambler’s Ruin problem where the initial wealth of each gambler are different, depending on the outcome of the most recent game. Mathematically, we can think of each sequence of games that ends in gambler A having j dollars where j = 0, … , k. The probability gambler A wins given that a specific sequence occurs is aⱼ. Any sequence that ends in gambler A having k dollars means that they won, so aₖ=1. Likewise, any sequence than ends in gambler A having 0 dollars means that they are in ruin so a₀=0. We are interested in determining the probabilities for all values of i=1, … , k – 1.

Using event notation, we can denote A₁ as the event that gambler A wins game 1. Similarly, B₁ is the event that gambler B wins game 1. The event W occurs when gambler A ends up with k dollars before they end up with 0 dollars. The probability that this event occurs can be derived using properties of conditional probability.

Probability of winning using conditional probabilities

Given that gambler A starts with i dollars, the probability that they win is P(W)=aᵢ. If gambler A wins one dollar in the first game, then their wealth becomes i+1. If they lost one dollar in the first game, their fortune becomes i – 1. The probability that they win the entire sequence will then depend on whether they won they won the first game. When we apply this logic to the previous equation, we know have an expression of the probability of winning the entire sequence of games that depends on the probability of winning one dollar each game and the conditional probabilities of winning the sequence given the gamblers wealth.

Probability of winning using problem notation

The wealth of gambler A at any given point in time varies between the total initial wealth of both gamblers and zero. In other words, given i=1, … , k – 1, we can plug in all possible values of i into the equation above to obtain k – 1 equations that determine the probability of winning based on adjacent values of i. We can use elementary algebra to aggregate these equations into a standardized format that can be simplified into a single formula. This formula specifies a fundamental relation between the probability of winning each game p, the total initial wealth of both gamblers k, and the probability of winning given a wealth of one dollar a₁. Once we have determined a₁, we can iteratively loop through all k – 1 to derive the probability aᵢ for all possible values of i.

Fundamental relation

We will now consider two possibilities: a fair game and an unfair game, which depends on the value of p that we plug into the equation above. In a fair game, where p=1/2, the base of the exponent in the right side of the equation can be simplified to (1 – p)/p=1. We can then simplify the entire equation as follows: 1 – a₁=(k – 1)a₁, which can be rearranged to a₁=1/k. If we iterate over all previous equations that determine the probabilities of winning for different values of i, we arrive at a general solution for fair games.

Solution for a fair game

The equation above is a remarkable result: given that the game is fair, the probability that gambler A will end up with k dollars before they end up with zero dollars is equal to their initial wealth i divided by the total wealth of both gamblers k.

If p is not equal to 1/2 the game is unfair, as one of the two gamblers has a systematic advantage. We can similarly derive a general solution which depends on the value of p and the wealth parameters.

Solution to an unfair game

Note: If the reader is interested in learning the mathematical proofs to arrive at the general solutions, consult the references at the end.

Markov Chains

Image for post

Photo by Karine Avetisyan on Unsplash

A sequence of random variables X that represent different points in time defined by discrete time intervals can be referred to as a stochastic process. The first random variable in the process is known as the initial state, and the rest of the random variables in the process define the state of each process at time n. Markov chains are a specific kind of stochastic process where conditional distributions of future states depend only on the present state. That is, the conditional distribution of X at time n + j for j > 0 depends only on the state of the process at time n, not on any of the earlier states up to n – 1. We can express this mathematically using the following notation.

Markov chain

A Markov chain is finite if the number of states that can occur at any point in time is noninfinite. Consider a chain with k states. The probability distribution of a state at time n+1 taking a specific value j given the state at time n is known as the transition distribution of the Markov chain. These distributions are considered stationary if the distribution is the same for each time n. We can use the notation pᵢⱼ to denote these distributions.

Stationary transition distributions

The total number of different values that pᵢⱼ can take depends on the total number of possible states k, which we can arrange in a k by k matrix P known as the transition matrix of the Markov chain.

Transition matrix

Transition matrices have important properties that make them unique. Since every element of the matrix represents a probability, all elements are positive. Since each row represents the entire conditional distribution of the next state given the value of the previous state, the values in each row sum to 1. We can extend the probability calculations to multiple steps in a straightforward way by using the transition matrix. That is, we can calculate the probability that the Markov chain will move from a state i to a state j in multiple steps m by taking the transition matrix P to the power of m. That is, the m-step transition matrix Pᵐ can be used to calculate the probabilities of specific states between any range of steps in the chain.

If we have a transition matrix where any of the diagonals pᵢᵢ are equal to 1, then the state i is considered an absorbing state. Once a Markov chain goes into an absorbing state, it cannot go into any other state thereafter. Another interesting property is that if a Markov chain has one or more absorbing states, the chain will be absorbed into one of those states eventually.

At the beginning of the Markov chain at time 1, we can specify a vector whose elements represent the probabilities that the chain will be in each state. This is known as the initial probability vector v. We can determine the marginal distribution of the chain at any time n by multiplying the initial probability vector v by the transition matrix P to the power of n – 1. For example, we can find the marginal distribution of the chain at time 2 by the expression vP.

A special case occurs when a probability vector multiplied by the transition matrix is equal to itself: vP=v. When this occurs, we call the probability vector the stationary distribution for the Markov chain.

Gambler’s Ruin Markov Chains

Using the theoretical framework for Markov chains, we can now apply these concepts to the Gambler’s Ruin problem. The fact that we are able to do this shows how intertwined probability and statistical theory can be. We initially framed the problem using exclusively conditional probability theorems derived from the basic probability axioms. Now we can formalize the problem even further and give it more structure using Markov chains. The process of taking an abstract concept and using various tools to analyze it and expand it underlines the magic of statistics.

The Gambler’s Ruin problem is essentially a Markov chain where the sequence of wealth amounts that gambler A has at any point in time determines the underlying structure. That is, at any point in time n, gambler A can have i wealth, where i also represents the state of the chain at time n. When the gambler reaches either 0 wealth or k wealth, the chain has moved into an absorbing state and no more games are played.

If the chain moves into any of the remaining k – 1 states 1, … , k – 1, a game is played again where the probability that gambler A will win p determines the marginal distribution of the state at that specific point in time. The transition matrix has two absorbing states. The first row corresponds to the scenario when gambler A has 0 wealth and the elements of the row are (1, 0, … , 0). Likewise, the last row of the transition matrix corresponds to the scenario when gambler A has reached k wealth and the elements are (0, … , 1). For every other row i, the elements are all zero expect for the terms with coordinates i – 1 and i + 1, which have values 1 – p and p respectively.

Gambler’s Ruin transition matrix

We can also determine the probabilities of states in multiple steps using the m-step transition matrix Pᵐ. As m goes to infinity, the m-step matrix converges but the stationary distributions are not unique. The limit matrix of Pᵐ has all zeroes except in its first and last columns. The last column contains all probabilities aᵢ that gambler A will end up with k dollars given that they started out with i dollars, while the first column contains all the respective complements of aᵢ. Since the stationary distributions are not unique, that means that all of the probabilities belong to the absorbing states.

Gambler’s Ruin limit matrix

This last point is especially important because it confirms our initial logical sequence of steps when deriving the solution formulas to the Gambler’s Ruin. In other words, we are able to derive a general formula for the problem as a whole because the stochastic processes (sequence of games) that occur in the problem converge to one of two absorbing states: gambler A walks away with k dollars or gambler A walks away with 0 dollars. Even though infinitely many games can be played, we can still determine the probability that either one of these two events occur because the transition matrix of the Markov chain converges to both stationary distributions.

Conclusion

The Gambler’s Ruin Problem is a great example of how you can take a complex situation and derive a simple general structure from it using statistical tools. It might be difficult to believe that, given a fair game, the probability that someone will win enough games to claim the total wealth of both players is determined by their initial wealth and the total wealth. This is known not only at the beginning of the sequence, but also at each step. Using Markov chains, we can determine the same probabilities between any sequences of games using the transition matrix and the probability vector at the initial state. Consider this, the conclusion that we came to in the first section of this post was enhanced by use of an additional concept. Applying different perspectives to the same problem can open the door to insightful analysis. This is the power of theoretical statistical thinking.

References

[1] M. H. Degroot and M. J. Schervish, Probability and Statistics (2018), Pearson

2021년 2월 24일 성남시 분당구 부동산 경매 데이터 분석

2021년 2월 24일 용인시 부동산 경매 데이터 분석

경기도 용인시 기흥구 금화로108번길 7, 2층215호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51688
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 69,000,000
경매가 23,667,000(34%)
유찰여부 유찰\t3회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층226호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51688
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 69,000,000
경매가 23,667,000(34%)
유찰여부 유찰\t3회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층216호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 12.192㎡]

항목
경매번호 2020타경51688
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 82,000,000
경매가 28,126,000(34%)
유찰여부 유찰\t3회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층235호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51688
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 69,000,000
경매가 23,667,000(34%)
유찰여부 유찰\t3회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 기흥구 금화로108번길 7, 2층234호 (상갈동,상갈동빌딩) [집합건물 일반철골구조 10.35㎡]

항목
경매번호 2020타경51688
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 69,000,000
경매가 23,667,000(34%)
유찰여부 유찰\t3회


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건

경기도 용인시 수지구 상현로 30-10, 225동 1층101호 (상현동,상현마을성원상떼빌아파트) [집합건물 철근콘크리트벽식조 106.52㎡]

항목
경매번호 2020타경2969
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 514,000,000
경매가 514,000,000(100%)
유찰여부 신건


<최근 1년 실거래가 정보>
– 총 거래 수: 98건
– 동일 평수 거래 수: 49건

최근 1년 동일 평수 거래건 보기

날짜 전용면적 가격
2021-02-07 106.52 17 75500
2020-12-19 106.52 12 72000
2020-12-24 106.52 13 74000
2020-12-24 106.52 13 74000
2020-11-10 106.52 12 68000
2020-11-13 106.52 18 63000
2020-11-20 106.52 19 71500
2020-11-26 106.52 13 68000
2020-11-28 106.52 19 70800
2020-11-04 106.52 2 63700
2020-10-15 106.52 13 64000
2020-10-25 106.52 20 62500
2020-09-15 106.52 4 62300
2020-09-22 106.52 10 65500
2020-09-03 106.52 17 61950
2020-09-05 106.52 17 64000
2020-07-10 106.52 7 62800
2020-07-15 106.52 19 62500
2020-07-18 106.52 12 63800
2020-07-21 106.52 1 59700
2020-07-30 106.52 16 60000
2020-07-04 106.52 20 60000
2020-07-06 106.52 9 60000
2020-06-12 106.52 11 60000
2020-06-15 106.52 6 55500
2020-06-18 106.52 3 59700
2020-06-08 106.52 19 57000
2020-05-16 106.52 19 55900
2020-05-02 106.52 16 55000
2020-05-28 106.52 6 54750
2020-04-02 106.52 19 57500
2020-03-11 106.52 3 55000
2020-02-10 106.52 9 51800
2020-02-11 106.52 20 53500
2020-02-11 106.52 15 54800
2020-02-13 106.52 1 48000
2020-02-14 106.52 4 51000
2020-02-14 106.52 20 53000
2020-02-15 106.52 15 54800
2020-02-17 106.52 15 53400
2020-02-17 106.52 12 53000
2020-02-18 106.52 17 56000
2020-02-19 106.52 5 56000
2020-02-20 106.52 11 54000
2020-02-22 106.52 4 51000
2020-02-22 106.52 18 58000
2020-02-27 106.52 10 55000
2020-02-03 106.52 3 49000
2020-02-03 106.52 18 52900

경기도 용인시 기흥구 탑실로 152, 211동 6층605호 (공세동,탑실마을대주피오레2단지) [집합건물 철근콘크리트구조 122.7737㎡]

항목
경매번호 2019타경5917
경매날짜 2021.03.10
법원 수원지방법원
담당 경매13계
감정평가금액 365,000,000
경매가 365,000,000(100%)
유찰여부 신건


<최근 1년 실거래가 정보>
– 총 거래 수: 0건
– 동일 평수 거래 수: 0건