本文整理汇总了C++中Outputs::set_information方法的典型用法代码示例。如果您正苦于以下问题:C++ Outputs::set_information方法的具体用法?C++ Outputs::set_information怎么用?C++ Outputs::set_information使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Outputs
的用法示例。
在下文中一共展示了Outputs::set_information方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
try
{
std::cout << "OpenNN. Airfoil Self-Noise Application." << std::endl;
srand((unsigned)time(NULL));
// Data set
DataSet data_set;
#ifdef __APPLE__
data_set.set_data_file_name("../../../../data/airfoil_self_noise.dat");
#else
data_set.set_data_file_name("../data/airfoil_self_noise.dat");
#endif
data_set.set_separator("Tab");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
Vector< Variables::Item > variables_items(6);
variables_items[0].name = "frequency";
variables_items[0].units = "hertzs";
variables_items[0].use = Variables::Input;
variables_items[1].name = "angle_of_attack";
variables_items[1].units = "degrees";
variables_items[1].use = Variables::Input;
variables_items[2].name = "chord_length";
variables_items[2].units = "meters";
variables_items[2].use = Variables::Input;
variables_items[3].name = "free_stream_velocity";
variables_items[3].units = "meters per second";
variables_items[3].use = Variables::Input;
variables_items[4].name = "suction_side_displacement_thickness";
variables_items[4].units = "meters";
variables_items[4].use = Variables::Input;
variables_items[5].name = "scaled_sound_pressure_level";
variables_items[5].units = "decibels";
variables_items[5].use = Variables::Target;
variables_pointer->set_items(variables_items);
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = variables_pointer->count_inputs_number();
const size_t hidden_perceptrons_number = 9;
const size_t outputs_number = variables_pointer->count_targets_number();
NeuralNetwork neural_network(inputs_number, hidden_perceptrons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
neural_network.construct_unscaling_layer();
UnscalingLayer* unscaling_layer_pointer = neural_network.get_unscaling_layer_pointer();
unscaling_layer_pointer->set_statistics(targets_statistics);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::NoUnscaling);
// Performance functional
//.........这里部分代码省略.........
示例2: main
int main(void)
{
try
{
std::cout << "OpenNN. Yacht Resistance Design Application." << std::endl;
srand((unsigned)time(NULL));
// Data set
DataSet data_set;
data_set.set_data_file_name("../data/yachtresistance.dat");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
variables_pointer->set_name(0, "longitudinal_center_buoyancy");
variables_pointer->set_name(1, "prismatic_coefficient");
variables_pointer->set_name(2, "length_displacement_ratio");
variables_pointer->set_name(3, "beam_draught_ratio");
variables_pointer->set_name(4, "length_beam_ratio");
variables_pointer->set_name(5, "froude_number");
variables_pointer->set_name(6, "residuary_resistance");
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = data_set.get_variables().count_inputs_number();
const size_t hidden_neurons_number = 30;
const size_t outputs_number = data_set.get_variables().count_targets_number();
NeuralNetwork neural_network(inputs_number, hidden_neurons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
neural_network.construct_unscaling_layer();
UnscalingLayer* unscaling_layer_pointer = neural_network.get_unscaling_layer_pointer();
unscaling_layer_pointer->set_statistics(targets_statistics);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::NoUnscaling);
// Performance functional
PerformanceFunctional performance_functional(&neural_network, &data_set);
// Training strategy
TrainingStrategy training_strategy(&performance_functional);
QuasiNewtonMethod* quasi_Newton_method_pointer = training_strategy.get_quasi_Newton_method_pointer();
quasi_Newton_method_pointer->set_maximum_iterations_number(1000);
quasi_Newton_method_pointer->set_reserve_performance_history(true);
quasi_Newton_method_pointer->set_display_period(100);
TrainingStrategy::Results training_strategy_results = training_strategy.perform_training();
// Testing analysis
TestingAnalysis testing_analysis(&neural_network, &data_set);
TestingAnalysis::LinearRegressionResults linear_regression_results = testing_analysis.perform_linear_regression_analysis();
// Save results
scaling_layer_pointer->set_scaling_method(ScalingLayer::MinimumMaximum);
unscaling_layer_pointer->set_unscaling_method(UnscalingLayer::MinimumMaximum);
//.........这里部分代码省略.........
示例3: main
int main(void)
{
try
{
int rank = 0;
#ifdef __OPENNN_MPI__
int size = 1;
MPI_Init(NULL,NULL);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#endif
if(rank == 0)
{
std::cout << "OpenNN. Yacht Resistance Design Application." << std::endl;
}
srand((unsigned)time(NULL));
// Global variables
DataSet data_set;
NeuralNetwork neural_network;
LossIndex loss_index;
TrainingStrategy training_strategy;
// Local variables
DataSet local_data_set;
NeuralNetwork local_neural_network;
LossIndex local_loss_index;
TrainingStrategy local_training_strategy;
if(rank == 0)
{
// Data set
data_set.set_data_file_name("../data/yachtresistance.dat");
data_set.load_data();
// Variables
Variables* variables_pointer = data_set.get_variables_pointer();
variables_pointer->set_name(0, "longitudinal_center_buoyancy");
variables_pointer->set_name(1, "prismatic_coefficient");
variables_pointer->set_name(2, "length_displacement_ratio");
variables_pointer->set_name(3, "beam_draught_ratio");
variables_pointer->set_name(4, "length_beam_ratio");
variables_pointer->set_name(5, "froude_number");
variables_pointer->set_name(6, "residuary_resistance");
const Matrix<std::string> inputs_information = variables_pointer->arrange_inputs_information();
const Matrix<std::string> targets_information = variables_pointer->arrange_targets_information();
// Instances
Instances* instances_pointer = data_set.get_instances_pointer();
instances_pointer->split_random_indices();
const Vector< Statistics<double> > inputs_statistics = data_set.scale_inputs_minimum_maximum();
const Vector< Statistics<double> > targets_statistics = data_set.scale_targets_minimum_maximum();
// Neural network
const size_t inputs_number = data_set.get_variables().count_inputs_number();
const size_t hidden_neurons_number = 30;
const size_t outputs_number = data_set.get_variables().count_targets_number();
neural_network.set(inputs_number, hidden_neurons_number, outputs_number);
Inputs* inputs = neural_network.get_inputs_pointer();
inputs->set_information(inputs_information);
Outputs* outputs = neural_network.get_outputs_pointer();
outputs->set_information(targets_information);
neural_network.construct_scaling_layer();
ScalingLayer* scaling_layer_pointer = neural_network.get_scaling_layer_pointer();
scaling_layer_pointer->set_statistics(inputs_statistics);
scaling_layer_pointer->set_scaling_method(ScalingLayer::NoScaling);
//.........这里部分代码省略.........