本文整理汇总了C++中NeuralNetwork::get_outputs_pointer方法的典型用法代码示例。如果您正苦于以下问题:C++ NeuralNetwork::get_outputs_pointer方法的具体用法?C++ NeuralNetwork::get_outputs_pointer怎么用?C++ NeuralNetwork::get_outputs_pointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeuralNetwork
的用法示例。
在下文中一共展示了NeuralNetwork::get_outputs_pointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_prune_output
void NeuralNetworkTest::test_prune_output(void) {
message += "test_prune_output\n";
NeuralNetwork nn;
// Test
nn.set(1, 1);
nn.prune_output(0);
assert_true(nn.get_inputs_pointer()->get_inputs_number() == 1, LOG);
assert_true(nn.get_outputs_pointer()->get_outputs_number() == 0, LOG);
// Test
nn.set(2, 2, 2);
nn.prune_output(1);
assert_true(nn.get_inputs_pointer()->get_inputs_number() == 2, LOG);
assert_true(nn.get_outputs_pointer()->get_outputs_number() == 1, LOG);
}
示例2: test_calculate_outputs
void NeuralNetworkTest::test_calculate_outputs(void) {
message += "test_calculate_outputs\n";
NeuralNetwork nn;
unsigned inputs_number;
unsigned outputs_number;
Vector<unsigned> architecture;
Vector<double> inputs;
Vector<double> outputs;
unsigned parameters_number;
Vector<double> parameters;
// Test
nn.set(3, 4, 2);
nn.initialize_parameters(0.0);
inputs.set(3, 0.0);
outputs = nn.calculate_outputs(inputs);
assert_true(outputs == 0.0, LOG);
// Test
nn.set(1, 1, 1);
nn.initialize_parameters(0.0);
inputs.set(1, 0.0);
outputs = nn.calculate_outputs(inputs);
assert_true(outputs == 0.0, LOG);
// Test
nn.set(1, 1);
inputs.set(1);
inputs.randomize_normal();
parameters = nn.arrange_parameters();
assert_true(
nn.calculate_outputs(inputs) == nn.calculate_outputs(inputs, parameters),
LOG);
// Test
nn.set(4, 3, 5);
inputs.set(4, 0.0);
parameters_number = nn.count_parameters_number();
parameters.set(parameters_number, 0.0);
outputs = nn.calculate_outputs(inputs, parameters);
assert_true(outputs.size() == 5, LOG);
assert_true(outputs == 0.0, LOG);
// Test
architecture.set(5);
architecture.randomize_uniform(5, 10);
nn.set(architecture);
inputs_number = nn.get_inputs_pointer()->get_inputs_number();
outputs_number = nn.get_outputs_pointer()->get_outputs_number();
inputs.set(inputs_number, 0.0);
parameters_number = nn.count_parameters_number();
parameters.set(parameters_number, 0.0);
outputs = nn.calculate_outputs(inputs, parameters);
assert_true(outputs.size() == outputs_number, LOG);
assert_true(outputs == 0.0, LOG);
}