diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-06-04 01:35:20 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-06-04 01:35:20 +0000 |
| commit | 3595239f08f2bc1df32ef22ed6de9bde10ca3384 (patch) | |
| tree | d9962c84e3a1f19e2da422f9bb49f65c21ada9f6 /ai | |
| parent | c9afda3ab74614fb36986f96b7972c082f275eca (diff) | |
Style cleanup, minor Matrix fixes, duplication validations, Pokemod methods
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@19 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'ai')
| -rw-r--r-- | ai/Layer.cpp | 4 | ||||
| -rw-r--r-- | ai/Layer.h | 2 | ||||
| -rw-r--r-- | ai/Net.h | 2 | ||||
| -rw-r--r-- | ai/Node.cpp | 6 | ||||
| -rw-r--r-- | ai/Node.h | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/ai/Layer.cpp b/ai/Layer.cpp index 97ba87b6..5ba794a1 100644 --- a/ai/Layer.cpp +++ b/ai/Layer.cpp @@ -51,7 +51,7 @@ void PokeGen::NeuralNetwork::Layer::DeleteNode(int n) void PokeGen::NeuralNetwork::Layer::UpdateBias(int n)
{
if (n < 0)
- bias.push_back((abs(std::rand())%201)/100.0);
+ bias.push_back((abs(std::rand()) % 201) / 100.0);
else if (n < GetNumNodes())
bias.erase(bias.begin() + n);
else
@@ -69,7 +69,7 @@ void PokeGen::NeuralNetwork::Layer::RandomizeWeights() {
bias.clear();
for (int i = 0; i < child->GetNumNodes(); ++i)
- bias.push_back((abs(std::rand())%201)/100.0);
+ bias.push_back((abs(std::rand()) % 201) / 100.0);
for (int i = 0; i < GetNumNodes(); ++i)
nodes[i].RandomizeWeights();
}
@@ -27,7 +27,7 @@ #include <vector>
#include <cstdlib>
#include "Node.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{
@@ -25,7 +25,7 @@ #define __NEURAL_NET__
#include "Layer.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{
diff --git a/ai/Node.cpp b/ai/Node.cpp index c95d6eae..9fc723d6 100644 --- a/ai/Node.cpp +++ b/ai/Node.cpp @@ -40,7 +40,7 @@ void PokeGen::NeuralNetwork::Node::UpdateWeights(int n) {
if (n < 0)
{
- weights.push_back((abs(std::rand())%201)/100.0);
+ weights.push_back((abs(std::rand()) % 201) / 100.0);
weightChanges.push_back(0);
}
else if (n < ownerLayer->child->GetNumNodes())
@@ -87,7 +87,7 @@ void PokeGen::NeuralNetwork::Node::RandomizeWeights() weights.clear();
int i = 0;
for (; i < ownerLayer->child->GetNumNodes(); ++i)
- weights.push_back((abs(std::rand())%201)/100.0);
+ weights.push_back((abs(std::rand()) % 201) / 100.0);
weightChanges.clear();
weightChanges.resize(i - 1, 0);
}
@@ -208,5 +208,5 @@ void PokeGen::NeuralNetwork::Node::CalculateValue() void PokeGen::NeuralNetwork::Node::DumpData(const std::string &f)
{
-
+ // TODO (Ben#1#): Dump NeuralNode data
}
@@ -29,7 +29,7 @@ #include <cstdlib>
#include <cmath>
#include "Layer.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{
|
