8 #include <boost/test/unit_test.hpp> 12 BOOST_AUTO_TEST_SUITE(booleans)
29 static const double threshold=0.4;
40 }
catch(std::runtime_error *e) {
41 BOOST_FAIL(e->what());
45 params.storeBest().crossValidation(e,0.5,10000,1,
false).setSeed(1);
47 double mse = net->
trainSGD(e,params);
49 BOOST_REQUIRE(mse<0.002);
52 BOOST_REQUIRE(booleanTest(net,0, 0,0,0)<threshold);
53 BOOST_REQUIRE(booleanTest(net,0, 0,1,1)<threshold);
54 BOOST_REQUIRE(booleanTest(net,0, 1,0,1)<threshold);
55 BOOST_REQUIRE(booleanTest(net,0, 1,1,0)<threshold);
56 BOOST_REQUIRE(booleanTest(net,1, 0,0,0)<threshold);
57 BOOST_REQUIRE(booleanTest(net,1, 0,1,0)<threshold);
58 BOOST_REQUIRE(booleanTest(net,1, 1,0,0)<threshold);
59 BOOST_REQUIRE(booleanTest(net,1, 1,1,1)<threshold);
86 BOOST_AUTO_TEST_SUITE_END()
NetType
The different types of network - each has an associated integer for saving/loading file data...
Training parameters for trainSGD(). This structure holds the parameters for the trainSGD() method...
boolean example set: 16 examples, 2 inputs, 1 output, 2 mod levels. There are 4 examples for each fun...
Useful stuff for testing.
double trainSGD(ExampleSet &examples, SGDParams ¶ms)
Train using stochastic gradient descent. Note that cross-validation parameters are slightly different...
void add1(double o00, double o01, double o10, double o11)
set the 4 examples at modulator=1
void add0(double o00, double o01, double o10, double o11)
set the 4 examples at modulator=0
static Net * makeNet(NetType t, ExampleSet &e, int hnodes)
Construct a single hidden layer network of a given type which conforms to the example set...
BOOST_AUTO_TEST_CASE(obxorand)
Test of output blending on XOR->AND modulation.
The abstract network type upon which all others are based. It's not pure virtual, in that it encapsul...