Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
511 views
in Technique[技术] by (71.8m points)

tensorflow - 用于AI玩的神经网络连接四:如何对输入和输出进行编码,以及哪种NN设置?(Neural network for AI playing Connect Four: how to encode inputs and outputs, and what kind of NN setup?)

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:

(是否使用以下内容会有所不同:)

  • 0 = empty, 1 = my piece, 2 = opponent's piece

    (0 =空,1 =我的棋子,2 =对手的棋子)

  • 0 = empty, 0.5 = my piece, 1 = opponent's piece

    (0 =空,0.5 =我的棋子,1 =对手的棋子)

  • 0 = empty, 1 = my piece, -1 = opponent's piece

    (0 =空,1 =我的棋子,-1 =对手的棋子)

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?

(SigmoidRelutanh作为激活功能?)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...