11 #include <boost/test/unit_test.hpp> 21 BOOST_AUTO_TEST_SUITE(saveload)
58 BOOST_REQUIRE(n->
type == saved->
type);
62 double *savedData =
new double[saved->
getDataSize()];
63 saved->
save(savedData);
67 BOOST_REQUIRE(oldData[i]==savedData[i]);
111 BOOST_AUTO_TEST_SUITE_END()
NetType
The different types of network - each has an associated integer for saving/loading file data...
static Net * load(const char *fn)
Load a network of any type from a file - note, endianness not checked!
void setH(int example, double h)
Set the h (modulator) for a given example.
Training parameters for trainSGD(). This structure holds the parameters for the trainSGD() method...
Useful stuff for testing.
virtual void save(double *buf) const =0
Serialize the data (not including any network type magic number or layer/node counts) to the given me...
double trainSGD(ExampleSet &examples, SGDParams ¶ms)
Train using stochastic gradient descent. Note that cross-validation parameters are slightly different...
double * getOutputs(int example)
Get a pointer to the outputs for a given example, for reading or writing.
static void save(const char *fn, Net *n)
Save a net of any type to a file - note, endianness not checked!
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...
virtual int getDataSize() const =0
Get the length of the serialised data block for this network.
void testSaveLoad(NetType tp)
NetType type
type of the network, used for load/save
BOOST_AUTO_TEST_CASE(saveloadplain)
Test that saving and loading a plain network leaves the weights and biases unchanged.
The abstract network type upon which all others are based. It's not pure virtual, in that it encapsul...
double * getInputs(int example)
Get a pointer to the inputs for a given example, for reading or writing.
A set of example data. Each datum consists of hormone (i.e. modulator value), inputs and outputs...