本文整理汇总了C++中NeuralNetwork::construct_independent_parameters方法的典型用法代码示例。如果您正苦于以下问题:C++ NeuralNetwork::construct_independent_parameters方法的具体用法?C++ NeuralNetwork::construct_independent_parameters怎么用?C++ NeuralNetwork::construct_independent_parameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeuralNetwork
的用法示例。
在下文中一共展示了NeuralNetwork::construct_independent_parameters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_save
void NeuralNetworkTest::test_save(void) {
message += "test_save\n";
std::string file_name = "../data/neural_network.xml";
NeuralNetwork nn;
IndependentParameters* ipp;
// Empty multilayer perceptron
nn.set();
nn.save(file_name);
// Only network architecture
nn.set(2, 4, 3);
nn.save(file_name);
// Only independent parameters
nn.set(2);
nn.save(file_name);
// Both network architecture and independent parameters
nn.set(1, 1, 1);
nn.construct_independent_parameters();
ipp = nn.get_independent_parameters_pointer();
ipp->set_parameters_number(1);
nn.save(file_name);
}
示例2: test_get_independent_parameters_pointer
void NeuralNetworkTest::test_get_independent_parameters_pointer(void) {
message += "test_get_independent_parameters_pointer\n";
NeuralNetwork nn;
nn.construct_independent_parameters();
// Test
assert_true(nn.get_independent_parameters_pointer() != NULL, LOG);
}
示例3: test_initialize_parameters
void NeuralNetworkTest::test_initialize_parameters(void) {
message += "test_initialize_parameters\n";
NeuralNetwork nn;
Vector<double> parameters;
IndependentParameters* ip;
// Test
nn.set(1, 1, 1);
nn.construct_independent_parameters();
ip = nn.get_independent_parameters_pointer();
ip->set_parameters_number(1);
nn.randomize_parameters_normal(1.0, 0.0);
parameters = nn.arrange_parameters();
assert_true(parameters == 1.0, LOG);
}
示例4: test_set_parameters
void NeuralNetworkTest::test_set_parameters(void) {
message += "test_set_parameters\n";
Vector<unsigned> multilayer_perceptron_architecture;
NeuralNetwork nn;
unsigned parameters_number;
Vector<double> parameters;
// Test
nn.set_parameters(parameters);
parameters = nn.arrange_parameters();
assert_true(parameters.size() == 0, LOG);
// Test
multilayer_perceptron_architecture.set(2, 2);
nn.set(multilayer_perceptron_architecture);
nn.construct_independent_parameters();
nn.get_independent_parameters_pointer()->set_parameters_number(2);
parameters_number = nn.count_parameters_number();
parameters.set(0.0, 1.0, parameters_number - 1);
nn.set_parameters(parameters);
parameters = nn.arrange_parameters();
assert_true(parameters.size() == parameters_number, LOG);
assert_true(parameters[0] == 0.0, LOG);
assert_true(parameters[parameters_number - 1] == parameters_number - 1.0,
LOG);
}