本文整理汇总了C++中CsvReader::readBiases方法的典型用法代码示例。如果您正苦于以下问题:C++ CsvReader::readBiases方法的具体用法?C++ CsvReader::readBiases怎么用?C++ CsvReader::readBiases使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader::readBiases方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trainNetWithParsedTrainData
Network trainNetWithParsedTrainData(vector<int> hiddenLayers, int epochs,
int miniBatchSize, double learningRate, double regularizationFactor) {
inputData_t data = generateInputData();
int input_dim = data.x_train.cols();
int output_dim = OUTPUT_SIZE;
vector<int> layers;
layers.push_back(input_dim);
layers.insert(layers.end(), hiddenLayers.begin(), hiddenLayers.end()); //inserta todos los elementos de hiddenLayers
layers.push_back(output_dim);
Network net(layers);
if (LOAD_NET){
CsvReader reader;
vector<MatrixXd> weights = reader.readWheights(WEIGHTS_BASE_LOAD_PATH,2);
vector<VectorXd> biases = reader.readBiases(BIASES_LOAD_PATH);
net = Network(layers,biases,weights);
}
if (TRAIN_NET){
cout << "Arranca train" << endl;
net.SGD(data.x_train, data.y_train, data.x_test, data.y_test, epochs, miniBatchSize,
learningRate, regularizationFactor);
}
int validationResult = net.accuracy(data.x_validation, data.y_validation);
double cost = net.totalCost(data.x_validation, data.y_validation);
cout << "---------------------------" << endl;
cout << "Validation results: " << validationResult << " / "
<< data.y_validation.rows() << endl;
cout << "---------------------------" << endl;
cout << "Validation cost: " << cost << endl;
cout << "---------------------------" << endl;
return net;
}