--People who like shogi --People who are interested in statistical modeling with pystan --Sota Fujii People who want to know if the double crown is amazing
――Examine how much the ability value differs between the first move and the second move for each Go player --Modeling the ability value of a professional shogi player using pystan --The ability of Go players is modeled as a normal distribution that varies from game to game. --Use the result of scraping the game result from the shogi rating site
Souta Fujii's double crown is strong, isn't it? The degree of exposure of shogi is increasing, such as being featured on TV.
The agenda often taken up in professional shogi is ** Is the late turn really disadvantageous? **something like. If you think about it normally, it seems that the first move is advantageous. As a matter of fact, in professional shogi, the winning percentage of the first move is slightly higher. (The first win rate is about 53%)
However, that is a story when viewed in the entire shogi world. Actually, it should be different for each Go player whether he is good at the first move or the second move. Generally, the rating of a Go player is given as a numerical value of the ability value of a Go player. On this rating site, the ability value of Go players is quantified. However, there is no quantification for each move. In addition, the sense of stability of the player's ability cannot be understood from the rating alone.
Therefore, in this article, Bayesian statistical modeling using pystan is used. -** How much difference in ability value will appear between the first move and the second move for each Go player ** -** Who are the players with big and small game irregularities ** I would like to consider.
By the way, the author's favorite battle type at the Ranging Rook Party is the Fourth File Rook.
--Scraping from rating site: http://kishibetsu.com/rating.html --Use the game results from January 2017 to September 2020 --Use only the results of players who have 10 or more games on the play and 10 or more on the play (to prevent outliers from being generated). ――The number of games used was 7733, and the number of Go players was 166.
As shown in the figure below, I created a dataframe that stores the first move (f column), the second move (s column), and the game result (result column, if true, the first move wins).
I referred to the method described in "Bayesian statistical modeling with Stan and R" in the reference. Details are also described in "I analyzed the strength of men's professional tennis with Bayesian modeling."
To give an overview **-The ability value of Go player is $ \ mu $, the ability unevenness is $ \ sigma $, and the ability at the time of the game is expressed by $ normal (\ mu, \ sigma) $ ――The one with the higher ability at the time of the game wins the game ** I am modeling. In other words, it is modeled that there are variations in each game with respect to the true ability of the Go player. This modeling also has the advantage of revealing unevenness in the game, which was not known from the rating alone.
How to model the ability of the first move and the second move, but this time I modeled it assuming that the first move and the second move are completely different people. In other words, the ability value of the first move is estimated only from the game result of the first move, and the ability value of the second move is estimated only from the game result of the second move.
In pystan, two rows, a winner's row and a loser's row, are given as the result of the game. Therefore, we created the winner line of w and the loser line of l as shown below.
python
df["w"] = np.where(df["result"],df["f_ID"],df["s_ID"])
df["l"] = np.where(df["result"],df["s_ID"],df["f_ID"])
The calculation was done by NUTS and took about an hour.
First of all, in order to confirm the validity of the calculation result, we will extract the top 20 Go players who have high ability values in the first version. The vertical axis is the actual value.
Also plotted is the average value of the modeled ability.
Looking at these results, the four people who are currently said to be the top four, Souta Fujii, Takuya Nagase, Masayuki Toyoshima, and Akira Watanabe, are the top four, and the results seem to be highly relevant. Significance even when looking at the quartile of the ability value It seems that there is a certain result.
The results of the second top 20 are shown below.
After all, "Sota Fujii, Takuya Nagase, Masayuki Toyoshima, Akira Watanabe" are the top four. However, compared to the previous one, other people will be replaced. From this, you can see that the ability value different from the first move is modeled. ** Rather than the second turn, Souta Fujii, overwhelming strength ... **
As a result of the above, it is considered that the modeling seems to be more valid. Next, we will consider how much difference there is between the first move and the second move.
Let's compare the ability values of the top players on the play, first and second. In the figure below, blue is the first move and orange is the second move. The boxes in the box plot represent the quartiles, and if these boxes do not overlap, it can be considered that there is a significant difference.
From the figure above, you can see the following. ――Many Go players have a slightly lower ability value in the second turn ――Shintaro Saito, Akira Watanabe, and Tatsuya Sugai are particularly different in their ability values. ――Sota Fujii and Yoshiharu Habu have little difference in ability between the second move and the first move
This result seems to be sensuously correct. Fujii's double crown has a high win rate even in the second turn, and Watanabe's double crown has the impression that he was particularly struggling in his turn for several years. From these facts, it was found that there is a big difference in the ability difference between the first move and the second move depending on the player **.
Next, we will visualize the players who have a large / small difference in ability between the first move and the second move. We focused on 39 top players and visualized the difference in ability.
First of all, the top 10 players who are stronger in the second turn.
The smaller the value, the stronger the second turn. The three people who stand out are Tetsuro Itodani, Taichi Takami, and Kenjiro Abe.
I don't have a strong impression of the second move, so I would like to hear the opinions of experts.
Next, there are 10 Go players who are stronger on the play. The larger the value, the stronger the first move. What stands out is Shintaro Saito. I don't have that impression either, so I'd like to ask for your opinion.
Next is the result of the Go player with the biggest unevenness in the game. As a result of the analysis, there were many Go players who did not make a big difference between the first move and the second move, so here we used only the analysis results of the first move.
The following are 10 Go players modeled as having a large game unevenness. Attention is Kazuki Kimura and Tatsuya Sugai. Considering from 2017, these two players have a history of winning titles, and it is thought that the explosive power at that time was modeled as uneven competition.
Next, there are 10 Go players with less unevenness in the game. It is interesting that Souta Fujii and Akira Watanabe are included here. These two people have high ability values and there is little unevenness in the game. Therefore, it can be said that these two people have won a stable victory with few missed games.
--Bayesian statistical modeling is performed to model the ability value of shogi players ――The difference in ability between the first move and the second move became clear. Many Go players are less capable in the back. ――Tetsuro Itodani, Taichi Takami, and Kenjiro Abe are the ones who are particularly strong in the second turn. ――Shintaro Saito is particularly strong on the play. ――Akira Watanabe and Souta Fujii have high ability values and small unevenness in the game. It can be said that it is winning stably.
If you find it interesting, thank you LGTM.
--Analysis of the second turn of the Ranging Rook Party Go player
Bayesian statistical modeling with Stan and R https://www.amazon.co.jp/Stan%E3%81%A8R%E3%81%A7%E3%83%99%E3%82%A4%E3%82%BA%E7%B5%B1%E8%A8%88%E3%83%A2%E3%83%87%E3%83%AA%E3%83%B3%E3%82%B0-Wonderful-R-2-%E6%9D%BE%E6%B5%A6-%E5%81%A5%E5%A4%AA%E9%83%8E-ebook/dp/B07M8LWLS1/ref=sr_1_1?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&dchild=1&keywords=stan%E3%81%A8R&qid=1602217801&sr=8-1 I tried to judge the strength of the sumo wrestler with the Bayes model https://qiita.com/a0082273/items/670ccafff23c3c576371 I tried to analyze the strength of men's professional tennis with Bayes modeling http://www.ie110704.net/2018/05/24/%E3%83%99%E3%82%A4%E3%82%BA%E3%83%A2%E3%83%87%E3%83%AA%E3%83%B3%E3%82%B0%E3%81%A7%E7%94%B7%E5%AD%90%E3%83%97%E3%83%AD%E3%83%86%E3%83%8B%E3%82%B9%E3%81%AE%E5%BC%B7%E3%81%95%E3%82%92%E5%88%86%E6%9E%90/