Function SaveFirstHid(DataSet&, Dimlp *, int, const std::string&, const std::string&)

Function Documentation

void SaveFirstHid(DataSet &data, Dimlp *net, int nbHid, const std::string &outfile, const std::string &firsthidFile)

Saves the values of the first hidden layer for each example in the dataset to a specified file.

This function performs a forward pass on each data example and writes the values of the first hidden layer to the specified file.

Parameters:
  • data – Reference to the dataset containing the examples.

  • net – Pointer to the Dimlp neural network.

  • nbHid – Number of neurons in the first hidden layer.

  • outfile – Name of the file where the output should be written (used for error messages).

  • firsthidFile – Name of the file where the first hidden layer values will be written.

Throws:

CannotOpenFileError – If the output file cannot be opened.