master
Peter Babič 9 years ago
parent 0376335294
commit 1c7b7151ad
  1. 1
      .gitignore
  2. BIN
      hello_ram-track.png
  3. BIN
      hello_strange.png
  4. BIN
      hello_strange_2.png
  5. BIN
      hello_strange_less.png
  6. BIN
      hello_track-ram.png
  7. BIN
      hello_zoomed.png
  8. 14
      src/neural/BattlefieldParameterEvaluator.java

1
.gitignore vendored

@ -12,3 +12,4 @@
hs_err_pid*
/bin/
*.png

BIN
hello_ram-track.png (Stored with Git LFS)

Binary file not shown.

BIN
hello_strange.png (Stored with Git LFS)

Binary file not shown.

BIN
hello_strange_2.png (Stored with Git LFS)

Binary file not shown.

BIN
hello_strange_less.png (Stored with Git LFS)

Binary file not shown.

BIN
hello_track-ram.png (Stored with Git LFS)

Binary file not shown.

BIN
hello_zoomed.png (Stored with Git LFS)

Binary file not shown.

@ -40,7 +40,7 @@ public class BattlefieldParameterEvaluator {
// Number of epochs for training
final static int NUM_TRAINING_EPOCHS = 100000;
// The requested error in nn training
final static double NN_TRAINING_ERROR = 0.01;
final static double NN_TRAINING_ERROR = 0.001;
// Maximum robot score obtained - used for scaling <0,1>
final static int BATTLE_MAX_SCORE = 250;
@ -121,14 +121,15 @@ public class BattlefieldParameterEvaluator {
System.out.println("Training network...");
final ResilientPropagation train = new ResilientPropagation(network, MyDataSet);
// int epoch = 1;
int epoch = 1;
do {
train.iteration();
// System.out.println("Epoch #" + epoch + " Error:" + train.getError());
// epoch++;
epoch++;
}
while (train.getError() > NN_TRAINING_ERROR);
System.out.println("The error of " + train.getError() + " was reached in " + epoch + " iterations.");
train.finishTraining();
System.out.println("Training completed.");
@ -148,11 +149,11 @@ public class BattlefieldParameterEvaluator {
// Simulate the neural network with the test samples and fill a matrix
for (int NdxBattleSize = 0; NdxBattleSize < NUMBATTLEFIELDSIZES; NdxBattleSize++) {
for (int NdxCooling = 0; NdxCooling < NUMCOOLINGRATES; NdxCooling++) {
// Get the output data using teached neural network
// Get the output data using taught neural network
BasicMLData input = new BasicMLData(MyTestData[NdxCooling + NdxBattleSize * NUMCOOLINGRATES]);
final MLData output = network.compute(input.clone());
double MyResult = output.getData()[0];
MyValue = ClipColor(MyResult);
MyValue = ClipColor(MyResult * 2);
MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
OutputRGBint[NdxCooling + NdxBattleSize * NUMCOOLINGRATES] = MyColor.getRGB();
}
@ -160,7 +161,8 @@ public class BattlefieldParameterEvaluator {
System.out.println("Testing completed.");
// Plot the training samples
for (int NdxSample = 0; NdxSample < NUMSAMPLES; NdxSample++) {
MyValue = ClipColor(FinalScore1[NdxSample] / BATTLE_MAX_SCORE);
// MyValue = ClipColor(FinalScore1[NdxSample] / BATTLE_MAX_SCORE);
MyValue = ClipColor(2 * FinalScore1[NdxSample] / 250);
MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue);
int MyPixelIndex = (int) (Math.round(NUMCOOLINGRATES * ((GunCoolingRate[NdxSample] / MAXGUNCOOLINGRATE) - 0.1) / 0.9) + Math
.round(NUMBATTLEFIELDSIZES * ((BattlefieldSize[NdxSample] / MAXBATTLEFIELDSIZE) - 0.1) / 0.9)

Loading…
Cancel
Save