help section redesigned

master
Peter Babič 9 years ago
parent c33da45185
commit 8fe58dca59
  1. 32
      data/output.data
  2. 100
      data/output.data#
  3. 176
      data/testing.scale.data
  4. 38
      robocode-svm

@ -1,65 +1,67 @@
2
2
1
2
2
2
1
1
2
2
2
2
2
1
2
1
2
2
2
1
1
2
2
2
2
1
1
2
1
1
2
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
1
1
1
2
2
2
2
1
2
2
1
2
1
2
2
2
1
1
2
2
2
1
2
1
2
1
2
2
1
2
2
2
@ -67,21 +69,20 @@
2
2
1
1
2
2
2
1
2
1
1
2
2
2
2
1
2
2
2
1
2
2
2
@ -92,8 +93,7 @@
2
2
2
2
2
1
2
2
2

@ -0,0 +1,100 @@
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
1
1
1
2
2
1
2
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
1
2
2
1
2
1
2
2
2
1
1
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2

@ -1,90 +1,3 @@
2 1:0.112224 2:0.222445 3:0.807263
1 1:0.326653 2:0.587174 3:0.206704
2 1:0.697395 2:0.140281 3:0.0307263
2 1:0.645291 2:0.478958 3:0.952514
2 1:0.563126 2:0.0220441 3:0.354749
1 1:0.224449 2:0.52505 3:0.902235
1 1:0.252505 2:0.599198 3:0.321229
2 1:0.422846 2:0.0601202 3:0.558659
2 1:0.735471 2:0.741483 3:0.634078
2 1:0.677355 2:0.160321 3:0.0307263
2 1:0.973948 2:0.701403 3:0.0782123
1 1:1 2:0.214429 3:0.0558659
1 1:0.0681363 2:0.569138 3:0.48324
2 1:0.837675 2:0.0801603 3:0.77095
1 1:0.288577 2:0.787575 3:0.393855
2 1:0.789579 2:0.388778 3:0.134078
2 1:0.336673 2:0.12024 3:0.603352
1 1:0.0761523 2:0.907816 3:0.251397
1 1:0.104208 2:0.767535 3:0.184358
2 1:0.128257 2:0.258517 3:0.363128
2 1:0.541082 2:0.0541082 3:0.860335
1 1:0.0801603 2:0.853707 3:0.335196
1 1:0.00801603 2:0.941884 3:0.25419
2 1:0.911824 2:0.911824 3:0.977654
2 1:0.0340681 2:0.579158 3:0.0642458
1 1:0.314629 2:0.845691 3:0.765363
2 1:0.158317 2:0.422846 3:0.846369
2 1:0.478958 2:0.228457 3:0.768156
2 1:0.863727 2:0.835671 3:0.446927
2 1:0.695391 2:0.817635 3:0.427374
2 1:0.478958 2:0.865731 3:0.385475
2 1:0.182365 2:0.45491 3:0.863128
2 1:0.54509 2:0.196393 3:0.583799
2 1:0.777555 2:0.50501 3:0.851955
2 1:0.777555 2:0.248497 3:0.198324
2 1:0.883768 2:0.438878 3:0.449721
2 1:0.380762 2:0.496994 3:0.416201
2 1:0.621242 2:0.226453 3:0.765363
2 1:0.591182 2:0.0240481 3:0.26257
1 1:0.0981964 2:0.897796 3:0.170391
1 1:0.214429 2:0.619238 3:0.843575
1 1:0.250501 2:0.775551 3:0.0726257
2 1:0.0741483 2:0.274549 3:0.0167598
2 1:0.883768 2:0.561122 3:0.717877
2 1:0.531062 2:0.284569 3:0.868715
2 1:0.440882 2:0.122244 3:0.73743
1 1:0.376754 2:0.623246 3:0.407821
2 1:0.769539 2:0.88978 3:0.854749
1 1:0.340681 2:0.829659 3:0.290503
2 1:0.388778 2:0.432866 3:0.986034
2 1:0.184369 2:0.174349 3:0.00837989
2 1:0.366733 2:0.358717 3:0.698324
2 1:0.775551 2:0.356713 3:0.575419
2 1:0.753507 2:0.709419 3:0.628492
2 1:0.452906 2:0.408818 3:0.446927
2 1:0.589178 2:0.973948 3:0.0642458
1 1:0.388778 2:0.937876 3:0.932961
2 1:0.707415 2:0.292585 3:0.463687
1 1:0.136273 2:0.807615 3:0.72905
2 1:0.897796 2:0.498998 3:0.047486
2 1:0.537074 2:0.893788 3:0.815642
2 1:0.735471 2:0.789579 3:0.480447
2 1:0.785571 2:0.759519 3:0.793296
2 1:0.693387 2:0.252505 3:0.120112
2 1:0.597194 2:0.322645 3:0.108939
2 1:0.466934 2:0.0681363 3:0.687151
2 1:0.921844 2:0.388778 3:0.513966
2 1:0.933868 2:0.619238 3:0.480447
1 1:0.248497 2:0.837675 3:0.265363
1 1:0.282565 2:0.591182 3:0.145251
2 1:0.537074 2:0.194389 3:0.231844
2 1:0.148297 2:0.254509 3:0.994413
2 1:0.392786 2:0.374749 3:0.0195531
1 2:0.617234 3:0.715084
1 1:0.290581 2:0.933868 3:0.0614525
1 1:0.0941884 2:0.983968 3:0.469274
2 1:0.114228 2:0.442886 3:0.709497
2 1:0.529058 2:0.90982 3:0.625698
2 1:0.0521042 2:0.352705 3:0.893855
2 1:0.517034 2:0.771543 3:0.712291
1 1:0.142285 2:0.809619 3:0.759777
2 1:0.987976 2:0.533066 3:0.555866
2 1:0.95992 2:0.338677 3:0.187151
2 1:0.695391 2:0.416834 3:0.100559
2 1:0.376754 2:0.521042 3:0.282123
2 1:0.659319 2:0.511022 3:0.798883
2 1:0.308617 2:0.0501002 3:0.76257
2 1:0.895792 2:0.230461 3:0.530726
2 1:0.402806 2:0.210421 3:0.455307
1 1:0.142285 2:0.901804 3:0.784916
@ -97,4 +10,91 @@
2 1:0.503006 2:0.406814 3:0.326816
2 1:0.647295 2:0.244489 3:0.0307263
2 1:0.52505 2:0.98998 3:0.469274
2 1:0.0501002 2:0.0160321 3:0.73
2 1:0.0501002 2:0.0160321 3:0.734637
2 1:0.809619 2:0.685371 3:0.899441
2 1:0.709419 2:0.0521042 3:0.706704
1 1:0.200401 2:0.619238 3:0.72905
2 1:0.0601202 2:0.122244 3:0.527933
2 1:0.47495 2:0.342685 3:0.256983
2 1:0.358717 2:0.0160321 3:0.0502793
2 1:0.621242 2:0.118236 3:0.709497
1 1:0.182365 2:0.633267 3:0.301676
1 1:0.142285 2:0.825651
1 1:0.208417 2:0.8998 3:0.877095
1 1:0.0420842 2:0.895792 3:0.0810056
2 1:0.587174 2:0.144289 3:0.365922
2 1:0.95992 2:0.945892 3:0.49162
1 1:0.372745 2:0.665331 3:0.184358
1 1:0.957916 2:0.0821643 3:0.96648
2 1:0.563126 2:0.248497 3:0.268156
2 1:0.0941884 2:0.410822 3:0.849162
2 1:0.547094 2:0.472946 3:0.997207
2 1:0.937876 2:0.346693 3:0.597765
1 1:0.93988 2:0.0641283 3:0.290503
1 1:0.140281 2:0.801603 3:0.256983
2 1:0.012024 2:0.380762 3:0.938547
2 1:0.617234 2:0.408818 3:0.743017
2 1:0.915832 2:0.891784 3:0.351955
2 1:0.717435 2:0.677355 3:0.75419
2 1:0.657315 2:0.42485 3:0.703911
1 1:0.0601202 2:0.843687 3:0.944134
2 1:0.537074 2:0.442886 3:0.930168
2 1:0.0180361 2:0.0280561 3:0.843575
2 1:0.901804 2:0.827655 3:0.617318
2 1:0.368737 2:0.977956 3:0.148045
2 1:0.549098 2:0.553106 3:0.986034
2 1:0.130261 2:0.162325 3:0.343575
1 1:0.0581162 2:0.677355 3:0.497207
2 1:0.468938 2:0.228457 3:0.642458
1 1:0.863727 2:0.00601202 3:0.586592
2 1:0.168337 2:0.1002 3:0.47486
2 1:0.400802 2:0.312625 3:0.449721
2 1:0.214429 2:0.244489 3:0.731844
1 1:0.220441 2:0.705411 3:0.73743
1 1:0.122244 2:0.803607 3:0.0391061
2 1:0.154309 2:0.150301 3:0.201117
2 1:0.503006 2:0.204409 3:0.301676
2 1:0.00601202 2:0.342685 3:0.921788
1 1:0.156313 2:0.98998 3:0.497207
2 1:0.178357 2:0.264529 3:0.47486
2 1:0.51503 2:0.827655 3:1
1 1:0.202405 2:0.785571 3:0.502793
2 1:0.607214 2:0.172345 3:0.994413
2 1:0.549098 2:0.913828 3:0.413408
1 1:0.206413 2:0.58517 3:0.100559
2 1:0.663327 2:0.621242 3:0.662011
2 1:0.775551 2:0.206413 3:0.377095
2 1:0.587174 2:0.336673 3:0.480447
2 1:0.218437 2:0.264529 3:0.837989
2 1:0.811623 2:0.220441 3:0.944134
2 1:0.887776 2:0.661323 3:0.701117
1 1:0.186373 2:0.665331 3:0.337989
2 1:0.769539 2:0.881764 3:0.153631
2 1:0.675351 2:0.482966 3:0.203911
2 1:0.755511 2:0.232465 3:0.0949721
2 1:0.907816 2:0.897796 3:0.673184
1 1:0.0160321 2:0.635271 3:0.153631
1 1:0.318637 2:0.795591 3:0.463687
2 1:0.51503 2:0.0781563 3:0.963687
2 1:0.641283 2:0.677355 3:0.927374
2 1:0.735471 2:0.306613 3:0.653631
2 1:0.284569 2:0.11022 3:0.810056
1 1:0.476954 2:0.543086 3:0.00558659
2 1:0.963928 2:0.246493 3:0.539106
2 1:0.781563 2:0.965932 3:0.796089
1 1:0.366733 2:0.687375 3:0.796089
2 1:0.458918 2:0.252505 3:0.25419
2 1:0.621242 2:0.0340681 3:0.131285
2 1:0.589178 2:0.324649 3:0.477654
2 1:0.747495 2:0.122244 3:0.0670391
2 1:0.887776 2:0.539078 3:0.50838
1 1:0.0440882 2:0.943888 3:0.0251397
2 1:0.332665 2:0.350701 3:0.815642
2 1:0.777555 2:0.308617 3:0.349162
2 1:0.739479 2:0.839679 3:0.631285
2 1:0.368737 2:0.358717 3:0.159218
1 1:0.132265 2:0.709419 3:0.857542
2 1:0.254509 2:0.176353 3:0.818436
2 1:0.757515 2:0.883768 3:0.284916
2 1:0.150301 2:0.0460922 3:0.51676
2 1:0.521042 2:0.238477 3:0.349162

@ -22,14 +22,16 @@ robot2="sample.Fire"
show_help() {
echo "Generate the data required for SVM classification and show the accuracy"
echo "of the generated SVM model. If coordinates are supported, one visual battle"
printf "is shown to support the prediction.\n\n"
echo "USAGE: robocode-svm ACTION [COORDINATES]"
echo " battle Shows visual run of the battle"
echo " -x The x coordinate of the second robot, used with -v"
echo " -y The y coordinate of the second robot, used with -v"
echo " accuracy Show the accuracy of the SVM model"
echo " clean Regenerate the battle data (may take a very long time)"
echo " help Show this help"
echo "is shown to support the prediction."
echo ""
echo "USAGE: robocode-svm ACTION"
echo "USAGE: robocode-svm --battle x y [alpha]"
echo ""
echo " --battle Shows visual run of the specified battle"
echo " -g,--generate Just generate the battle data"
echo " -a,--accuracy Show the accuracy of the SVM model,"
echo " -c,--clean Delete all the battle data!"
echo " -h,--help Show this help"
}
# Generate the missing amount of data from running battles
@ -88,10 +90,10 @@ generate_data() {
# Recalculate and display the accuracy of the SVM
show_accuracy() {
# Check if the data have been generated, if not, generate first
generate_data quiet
generate_data #quiet
# Calculate the lines needed to split the data to 90% and 10%
tr=$(bc <<< "scale=0; $rounds * 0.9 / 1");
tr=$(bc <<< "scale=0; ($rounds * 0.9) / 1");
te=$(bc <<< "scale=0; ($rounds - $tr) / 1");
# Scale the results to interval <0, 1> and split them to training set and testing set;
@ -100,32 +102,36 @@ show_accuracy() {
# Train the SVM with the training data
svm-train -c 10 -g 2 "$training" "$model" > /dev/null
# Check the accuracy of the testing data against the SVM model made of training data
svm-predict "$testing" "$model" "$output" | grep "Accuracy"
svm-predict "$testing" "$model" "$output"
}
# Iterate over arguments
while :; do
case $1 in
generate)
-g|--generate)
generate_data verbose
exit
;;
accuracy)
-a|--accuracy)
show_accuracy
exit
;;
clean)
-b|--battle)
run_battle
exit
;;
-c|--clean)
rm -rf "$datadir"
echo "All the SVM data have been deleted."
exit
;;
help|-h|-\?|--help)
-h|-\?|--help)
show_help
exit
;;
*)
echo "Type help for list of supported commands."
echo "Type \`robocode-svm --help\` for list of supported commands."
exit
esac
# "command" reduces the chance of fatal errors in many shells.

Loading…
Cancel
Save