Trying to understand how to build and train neural network based AI for games, and struggling to get some details straight.
(试图了解如何构建和训练基于神经网络的游戏AI,并努力获得一些细节。)
Not even concerned yet with whether to use TensorFlow or something else or build my own.
(甚至不关心是否使用TensorFlow或其他东西或自己构建。)
First I'm trying to grasp some basics such as what ranges to use, eg inputs between -1 and 1 or between 0 and 1, or how to represent input game situations and output moves. (首先,我试图掌握一些基础知识,例如使用的范围,例如-1和1之间或0和1之间的输入,或如何表示输入游戏情况和输出移动。)
Suppose I'm building a neural network to play Connect Four .
(假设我正在构建一个神经网络来玩“ 连接四号”游戏 。)
Given a game situation, the AI is to generate an 'optimal move'. (给定游戏情况,AI将生成“最佳移动”。)
Let's say the optimal move is the move with the highest probability of eventually winning the game, assuming a reasonably smart opponent. (比方说,最佳举动是假设对手是相当聪明的人,最终赢得比赛的可能性最高。)
I guess the input would be 7 columns * 6 rows = 42 input neurons, each containing a value that represents either my color, or the opponent's color, or empty.
(我猜输入将是7列* 6行= 42个输入神经元,每个神经元包含一个代表我的颜色或对手的颜色或空的值。)
How do I encode this? (我该如何编码?)
Does it make a difference whether I use: (是否使用以下内容会有所不同:)
Or should I even use two times 42 = 84 input neurons, all binary/boolean, where 0=empty, 1s in the first 42 neurons represent my pieces, and 1s in the second 42 neurons represent the opponent's pieces?
(还是我应该使用两次42 = 84个输入神经元,全部为二进制/布尔值,其中0 =空,前42个神经元中的1s代表我的棋子,而后42个神经元中的1s代表对手的棋子?)
What does the output look like?
(输出是什么样的?)
7 neurons that each represent one column, getting an output value in the 0..1 range, and the AI's move would be the one with the highest value? (7个神经元,每个神经元代表一列,输出值在0..1范围内,而AI的动作将是具有最高值的那一个?)
Or just one output value ranging from 0 to 1, where roughly each 1/7th of the interval represents a particular column? (还是只有一个介于0到1之间的输出值,其中大约每间隔的1/7代表一个特定的列?)
Also, how should I design my neural network, how many hidden layers?
(另外,我应该如何设计我的神经网络,多少个隐藏层?)
Classification or regression? (分类还是回归?)
Sigmoid or Relu or tanh as activation function? (Sigmoid或Relu或tanh作为激活功能?)
Intuitively, based on my limited experience with neural networks, I would say 2 or 3 hidden layers, each with two times the number of input neurons.
(凭直觉,根据我在神经网络方面的有限经验,我会说2到3个隐藏层,每个隐藏层具有两倍的输入神经元数量。)
No idea about the other considerations, I would just make stabs in the dark and trial and error. (不知道其他考虑因素,我只是在黑暗中试穿,反复试验。)
Any feedback or suggestions to get me in the right direction?
(有任何反馈或建议可以帮助我朝正确的方向发展吗?)
ask by RocketNuts translate from so