Q 학습 알고리즘을 구현하려고했으나 문제가 있습니다. 작동하지 않고 100000 회 게임을하고 1000 반복을 사용하여 각 단계를 학습했습니다.) 아직 배우지 못합니다. 네트워크 게임은 연결된 이미지에서 http://imgur.com/a/hATfB 여기서 각각의 트레이닝 단계에서 일어나는 것이다 같습니다 backprop위한Q 깊은 학습 알고리즘이 작동하지 않습니다.
double maxQval;
double[] inputvec;
int MaxQ = GetRandDir(state, out maxQval, out inputvec);//input vec is board
double[] QtarVec = new double[] { 0, 0, 0, 0 };
double r = GetR((int)state[0], (int)state[1]); // GetR is reward
QtarVec[MaxQ] = Qtar(r, maxQval); // backprop vector of 0's except Qtar replaces a value
associator.Train(50, new double[][] { inputvec }, new double[][] { QtarVec });
트레이닝 데이터 쌍은 (I 화상에 연결된 입력 QTarget = R + 감마 * MAXQ) MAXQ은 최대 네트워크 출력 레이어 활성화 또는 무작위 추출 (엡실론 욕심쟁이). r은 각 이동에서 얻은 보상이고, -10은 장애물이고 10은 목표입니다. (난 그냥 10의 목표 및 0 다른 모든 것들에 대한 시도했다 althogh. 여기에 훈련 코드입니다.
public void Train(int nTrails)
{
double[] state = new double[] { 1, 1 }; // inital position
int its = 0;
for (int i = 0; i < nTrails; i++)
{
while (((state[0] < 4) && (state[1] < 4))&&((state[0] * 100 >0) && (state[1] * 100 >0)) && (state[0] != 3 && state[1] != 3))//while on board and not at goal postion
{
double temp = r.NextDouble();
int next = -1;
lines.Add(new Vector2((float)(state[0] * 100), (float)(state[1] * 100)));
if (temp < epsilon)
{
next = TrainRandIt(state); // move random direction, backprop
}
else
{
next = TrainMaxIt(state); // move in max activation direction, backprop
}
if (next == 0) .//updating postion
{
state[0]++;
}
else if (next == 1)
{
state[0]--;
}
else if (next == 2)
{
state[1]++;
}
else if (next == 3)
{
state[1]--;
}
}
}
state[0] = 1;
state[1] = 1; // resetting game
}
어떤 도움 감사합니다.
들여 쓰기는 코드를 읽기 쉽게 만듭니다. –
고마워요. –