pktools 2.6.7
Processing Kernel for geospatial data
Classes | Public Member Functions | Protected Attributes | List of all members
FANN::neural_net Class Reference

Public Member Functions

void destroy ()
 
bool create_standard (unsigned int num_layers,...)
 
bool create_standard_array (unsigned int num_layers, const unsigned int *layers)
 
bool create_sparse (float connection_rate, unsigned int num_layers,...)
 
bool create_sparse_array (float connection_rate, unsigned int num_layers, const unsigned int *layers)
 
bool create_shortcut (unsigned int num_layers,...)
 
bool create_shortcut_array (unsigned int num_layers, const unsigned int *layers)
 
fann_type * run (fann_type *input)
 
std::vector< fann_type > run (std::vector< fann_type > input)
 
void randomize_weights (fann_type min_weight, fann_type max_weight)
 
void init_weights (const training_data &data)
 
void print_connections ()
 
bool create_from_file (const std::string &configuration_file)
 
bool save (const std::string &configuration_file)
 
int save_to_fixed (const std::string &configuration_file)
 
void train (fann_type *input, fann_type *desired_output)
 
float train_epoch (const training_data &data)
 
void train_on_data (const training_data &data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error)
 
void train_on_data (const std::vector< std::vector< fann_type > > &input, const std::vector< std::vector< fann_type > > &output, bool initWeights, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error)
 
void train_on_data (const std::vector< Vector2d< fann_type > > &input, unsigned int num_data, bool initWeights, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error)
 
float cross_validation (std::vector< Vector2d< fann_type > > &trainingFeatures, unsigned int ntraining, unsigned short cv, unsigned int max_epochs, float desired_error, std::vector< unsigned short > &referenceVector, std::vector< unsigned short > &outputVector, short verbose=0)
 
float cross_validation (std::vector< std::vector< fann_type > > &input, std::vector< std::vector< fann_type > > &output, unsigned short cv, unsigned int max_epochs, float desired_error, std::vector< std::vector< fann_type > > &referenceVector, std::vector< std::vector< fann_type > > &outputVector, short verbose=0)
 
void train_on_file (const std::string &filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error)
 
fann_type * test (fann_type *input, fann_type *desired_output)
 
float test_data (const training_data &data)
 
float test_data (const std::vector< Vector2d< fann_type > > &input, unsigned int num_data)
 
float get_MSE ()
 
void reset_MSE ()
 
void set_callback (callback_type callback, void *user_data)
 
void print_parameters ()
 
training_algorithm_enum get_training_algorithm ()
 
void set_training_algorithm (training_algorithm_enum training_algorithm)
 
float get_learning_rate ()
 
void set_learning_rate (float learning_rate)
 
activation_function_enum get_activation_function (int layer, int neuron)
 
void set_activation_function (activation_function_enum activation_function, int layer, int neuron)
 
void set_activation_function_layer (activation_function_enum activation_function, int layer)
 
void set_activation_function_hidden (activation_function_enum activation_function)
 
void set_activation_function_output (activation_function_enum activation_function)
 
fann_type get_activation_steepness (int layer, int neuron)
 
void set_activation_steepness (fann_type steepness, int layer, int neuron)
 
void set_activation_steepness_layer (fann_type steepness, int layer)
 
void set_activation_steepness_hidden (fann_type steepness)
 
void set_activation_steepness_output (fann_type steepness)
 
error_function_enum get_train_error_function ()
 
void set_train_error_function (error_function_enum train_error_function)
 
float get_quickprop_decay ()
 
void set_quickprop_decay (float quickprop_decay)
 
float get_quickprop_mu ()
 
void set_quickprop_mu (float quickprop_mu)
 
float get_rprop_increase_factor ()
 
void set_rprop_increase_factor (float rprop_increase_factor)
 
float get_rprop_decrease_factor ()
 
void set_rprop_decrease_factor (float rprop_decrease_factor)
 
float get_rprop_delta_min ()
 
void set_rprop_delta_min (float rprop_delta_min)
 
float get_rprop_delta_max ()
 
void set_rprop_delta_max (float rprop_delta_max)
 
unsigned int get_num_input ()
 
unsigned int get_num_output ()
 
unsigned int get_total_neurons ()
 
unsigned int get_total_connections ()
 
network_type_enum get_network_type ()
 
float get_connection_rate ()
 
unsigned int get_num_layers ()
 
void get_layer_array (unsigned int *layers)
 
void get_layer_array (std::vector< unsigned int > vlayers)
 
void get_bias_array (unsigned int *bias)
 
void get_connection_array (connection *connections)
 
void get_connection_array (std::vector< connection > &convector)
 
void set_weight_array (connection *connections, unsigned int num_connections)
 
void set_weight_array (std::vector< connection > convector)
 
void set_weight (unsigned int from_neuron, unsigned int to_neuron, fann_type weight)
 
float get_learning_momentum ()
 
void set_learning_momentum (float learning_momentum)
 
stop_function_enum get_train_stop_function ()
 
void set_train_stop_function (stop_function_enum train_stop_function)
 
fann_type get_bit_fail_limit ()
 
void set_bit_fail_limit (fann_type bit_fail_limit)
 
unsigned int get_bit_fail ()
 
void cascadetrain_on_data (const training_data &data, unsigned int max_neurons, unsigned int neurons_between_reports, float desired_error)
 
void cascadetrain_on_file (const std::string &filename, unsigned int max_neurons, unsigned int neurons_between_reports, float desired_error)
 
float get_cascade_output_change_fraction ()
 
void set_cascade_output_change_fraction (float cascade_output_change_fraction)
 
unsigned int get_cascade_output_stagnation_epochs ()
 
void set_cascade_output_stagnation_epochs (unsigned int cascade_output_stagnation_epochs)
 
float get_cascade_candidate_change_fraction ()
 
void set_cascade_candidate_change_fraction (float cascade_candidate_change_fraction)
 
unsigned int get_cascade_candidate_stagnation_epochs ()
 
void set_cascade_candidate_stagnation_epochs (unsigned int cascade_candidate_stagnation_epochs)
 
fann_type get_cascade_weight_multiplier ()
 
void set_cascade_weight_multiplier (fann_type cascade_weight_multiplier)
 
fann_type get_cascade_candidate_limit ()
 
void set_cascade_candidate_limit (fann_type cascade_candidate_limit)
 
unsigned int get_cascade_max_out_epochs ()
 
void set_cascade_max_out_epochs (unsigned int cascade_max_out_epochs)
 
unsigned int get_cascade_max_cand_epochs ()
 
void set_cascade_max_cand_epochs (unsigned int cascade_max_cand_epochs)
 
unsigned int get_cascade_num_candidates ()
 
unsigned int get_cascade_activation_functions_count ()
 
activation_function_enum * get_cascade_activation_functions ()
 
void set_cascade_activation_functions (activation_function_enum *cascade_activation_functions, unsigned int cascade_activation_functions_count)
 
unsigned int get_cascade_activation_steepnesses_count ()
 
fann_type * get_cascade_activation_steepnesses ()
 
void set_cascade_activation_steepnesses (fann_type *cascade_activation_steepnesses, unsigned int cascade_activation_steepnesses_count)
 
unsigned int get_cascade_num_candidate_groups ()
 
void set_cascade_num_candidate_groups (unsigned int cascade_num_candidate_groups)
 
void scale_train (training_data &data)
 
void descale_train (training_data &data)
 
bool set_input_scaling_params (const training_data &data, float new_input_min, float new_input_max)
 
bool set_output_scaling_params (const training_data &data, float new_output_min, float new_output_max)
 
bool set_scaling_params (const training_data &data, float new_input_min, float new_input_max, float new_output_min, float new_output_max)
 
bool clear_scaling_params ()
 
void scale_input (fann_type *input_vector)
 
void scale_output (fann_type *output_vector)
 
void descale_input (fann_type *input_vector)
 
void descale_output (fann_type *output_vector)
 
void set_error_log (FILE *log_file)
 
unsigned int get_errno ()
 
void reset_errno ()
 
void reset_errstr ()
 
std::string get_errstr ()
 
void print_error ()
 

Protected Attributes

struct fann * ann
 

Detailed Description

Definition at line 978 of file myfann_cpp.h.

Constructor & Destructor Documentation

◆ neural_net()

FANN::neural_net::neural_net ( )
inline

Definition at line 990 of file myfann_cpp.h.

990 : ann(NULL)
991 {
992 }

◆ ~neural_net()

FANN::neural_net::~neural_net ( )
inline

Definition at line 1005 of file myfann_cpp.h.

1006 {
1007 destroy();
1008 }

Member Function Documentation

◆ cascadetrain_on_data()

void FANN::neural_net::cascadetrain_on_data ( const training_data data,
unsigned int  max_neurons,
unsigned int  neurons_between_reports,
float  desired_error 
)
inline

Definition at line 3081 of file myfann_cpp.h.

3083 {
3084 if ((ann != NULL) && (data.train_data != NULL))
3085 {
3086 fann_cascadetrain_on_data(ann, data.train_data, max_neurons,
3087 neurons_between_reports, desired_error);
3088 }
3089 }

◆ cascadetrain_on_file()

void FANN::neural_net::cascadetrain_on_file ( const std::string &  filename,
unsigned int  max_neurons,
unsigned int  neurons_between_reports,
float  desired_error 
)
inline

Definition at line 3100 of file myfann_cpp.h.

3102 {
3103 if (ann != NULL)
3104 {
3105 fann_cascadetrain_on_file(ann, filename.c_str(),
3106 max_neurons, neurons_between_reports, desired_error);
3107 }
3108 }

◆ clear_scaling_params()

bool FANN::neural_net::clear_scaling_params ( )
inline

Definition at line 3781 of file myfann_cpp.h.

3782 {
3783 bool status = false;
3784 if (ann != NULL)
3785 {
3786 status = (fann_clear_scaling_params(ann) != -1);
3787 }
3788 return status;
3789 }

◆ create_from_file()

bool FANN::neural_net::create_from_file ( const std::string &  configuration_file)
inline

Definition at line 1340 of file myfann_cpp.h.

1341 {
1342 destroy();
1343 ann = fann_create_from_file(configuration_file.c_str());
1344 return (ann != NULL);
1345 }

◆ create_shortcut()

bool FANN::neural_net::create_shortcut ( unsigned int  num_layers,
  ... 
)
inline

Definition at line 1174 of file myfann_cpp.h.

1175 {
1176 va_list layers;
1177 std::vector<unsigned int> arr(num_layers);//pk
1178 //unsigned int arr[num_layers];
1179
1180 va_start(layers, num_layers);
1181 /* bool status = create_shortcut_array(num_layers, */
1182 /* reinterpret_cast<const unsigned int *>(layers)); */
1183 for (unsigned int ii = 0; ii < num_layers; ii++)
1184 arr[ii] = va_arg(layers, unsigned int);
1185 bool status = create_shortcut_array(num_layers, &(arr[0]));//
1186 //bool status = create_shortcut_array(num_layers, arr);
1187
1188 va_end(layers);
1189 return status;
1190 }

◆ create_shortcut_array()

bool FANN::neural_net::create_shortcut_array ( unsigned int  num_layers,
const unsigned int *  layers 
)
inline

Definition at line 1205 of file myfann_cpp.h.

1207 {
1208 destroy();
1209 ann = fann_create_shortcut_array(num_layers, layers);
1210 return (ann != NULL);
1211 }

◆ create_sparse()

bool FANN::neural_net::create_sparse ( float  connection_rate,
unsigned int  num_layers,
  ... 
)
inline

Definition at line 1118 of file myfann_cpp.h.

1119 {
1120 va_list layers;
1121 std::vector<unsigned int> arr(num_layers);//pk
1122 //unsigned int arr[num_layers];
1123
1124 va_start(layers, num_layers);
1125 /* bool status = create_sparse_array(connection_rate, num_layers, */
1126 /* reinterpret_cast<const unsigned int *>(layers)); */
1127
1128 for (unsigned int ii = 0; ii < num_layers; ii++)
1129 arr[ii] = va_arg(layers, unsigned int);
1130 bool status = create_sparse_array(connection_rate, num_layers, &(arr[0]));//pk
1131 //bool status = create_sparse_array(connection_rate, num_layers, arr);
1132
1133 va_end(layers);
1134 return status;
1135 }

◆ create_sparse_array()

bool FANN::neural_net::create_sparse_array ( float  connection_rate,
unsigned int  num_layers,
const unsigned int *  layers 
)
inline

Definition at line 1149 of file myfann_cpp.h.

1151 {
1152 destroy();
1153 ann = fann_create_sparse_array(connection_rate, num_layers, layers);
1154 return (ann != NULL);
1155 }

◆ create_standard()

bool FANN::neural_net::create_standard ( unsigned int  num_layers,
  ... 
)
inline

Definition at line 1061 of file myfann_cpp.h.

1062 {
1063 va_list layers;
1064 std::vector<unsigned int> arr(num_layers);//pk
1065 //unsigned int arr[num_layers];
1066
1067 va_start(layers, num_layers);
1068 /* bool status = create_standard_array(num_layers, */
1069 /* reinterpret_cast<const unsigned int *>(layers)); */
1070 for (unsigned int ii = 0; ii < num_layers; ii++)
1071 arr[ii] = va_arg(layers, unsigned int);
1072 bool status = create_standard_array(num_layers, &(arr[0]));//pk
1073 //bool status = create_standard_array(num_layers, arr);
1074 va_end(layers);
1075 return status;
1076 }

◆ create_standard_array()

bool FANN::neural_net::create_standard_array ( unsigned int  num_layers,
const unsigned int *  layers 
)
inline

Definition at line 1089 of file myfann_cpp.h.

1090 {
1091 destroy();
1092 ann = fann_create_standard_array(num_layers, layers);
1093 return (ann != NULL);
1094 }

◆ cross_validation() [1/2]

float FANN::neural_net::cross_validation ( std::vector< std::vector< fann_type > > &  input,
std::vector< std::vector< fann_type > > &  output,
unsigned short  cv,
unsigned int  max_epochs,
float  desired_error,
std::vector< std::vector< fann_type > > &  referenceVector,
std::vector< std::vector< fann_type > > &  outputVector,
short  verbose = 0 
)
inline

Definition at line 1663 of file myfann_cpp.h.

1671 {
1672 assert(input.size());
1673 assert(output.size()==input.size());
1674 unsigned int ntraining=input.size();
1675 unsigned int noutput=output[0].size();
1676 referenceVector.clear();
1677 outputVector.clear();
1678 assert(cv<ntraining);
1679 float rmse=0;
1680 std::vector< std::vector<fann_type> > testInput;
1681 std::vector< std::vector<fann_type> > testOutput;
1682 int testsample=0;//sample to leave out
1683 int nrun=(cv>1)? cv : ntraining;
1684 if(nrun>ntraining)
1685 nrun=ntraining;
1686 for(int irun=0;irun<nrun;++irun){
1687 if(verbose>1)
1688 std::cout << "run " << irun << std::endl;
1689 //reset training sample from last run
1690 if(verbose>1)
1691 std::cout << "reset training sample from last run" << std::endl;
1692 while(testInput.size()){
1693 input.push_back(testInput.back());
1694 testInput.pop_back();
1695 }
1696 while(testOutput.size()){
1697 output.push_back(testOutput.back());
1698 testOutput.pop_back();
1699 }
1700 assert(testInput.size()==testOutput.size());
1701 if(verbose>1){
1702 std::cout << "training size: " << input.size() << std::endl;
1703 std::cout << "test size: " << testInput.size() << std::endl;
1704 }
1705 assert(input.size());
1706 //create test sample
1707 if(verbose>1)
1708 std::cout << "create test sample" << std::endl;
1709 unsigned int nsample=0;
1710 int ntest=(cv>1)? ntraining/cv : 1; //n-fold cross validation or leave-one-out
1711 while(nsample<ntest){
1712 testInput.push_back(input[0]);
1713 testOutput.push_back(output[0]);
1714 input.erase(input.begin());
1715 output.erase(output.begin());
1716 assert(input.size());
1717 assert(output.size());
1718 assert(input.size()==output.size());
1719 ++nsample;
1720 }
1721 assert(nsample==ntest);
1722 assert(testInput.size()==testOutput.size());
1723 //training with left out training set
1724 if(verbose>1)
1725 std::cout << std::endl << "Set training data" << std::endl;
1726 bool initWeights=true;
1727 unsigned int epochs_between_reports=0;
1728
1729 train_on_data(input,output,initWeights, max_epochs,
1730 epochs_between_reports, desired_error);
1731 //cross validation with testFeatures
1732 if(verbose>1)
1733 std::cout << std::endl << "Cross validation" << std::endl;
1734
1735 std::vector<fann_type> result(noutput);
1736 for(int isample=0;isample<testInput.size();++isample){
1737 result=run(testInput[isample]);
1738 referenceVector.push_back(testOutput[isample]);
1739 outputVector.push_back(result);
1740 }
1741 }
1742 //reset from very last run
1743 while(testInput.size()){
1744 input.push_back(testInput.back());
1745 testInput.pop_back();
1746 }
1747 while(testOutput.size()){
1748 output.push_back(testOutput.back());
1749 testOutput.pop_back();
1750 }
1751 return 0;
1752 }

◆ cross_validation() [2/2]

float FANN::neural_net::cross_validation ( std::vector< Vector2d< fann_type > > &  trainingFeatures,
unsigned int  ntraining,
unsigned short  cv,
unsigned int  max_epochs,
float  desired_error,
std::vector< unsigned short > &  referenceVector,
std::vector< unsigned short > &  outputVector,
short  verbose = 0 
)
inline

Definition at line 1553 of file myfann_cpp.h.

1561 {
1562 referenceVector.clear();
1563 outputVector.clear();
1564 assert(cv<ntraining);
1565 float rmse=0;
1566 int nclass=trainingFeatures.size();
1567 std::vector< Vector2d<float> > testFeatures(nclass);
1568 int testclass=0;//class to leave out
1569 int testsample=0;//sample to leave out
1570 int nrun=(cv>1)? cv : ntraining;
1571 if(nrun>ntraining)
1572 nrun=ntraining;
1573 for(int irun=0;irun<nrun;++irun){
1574 if(verbose>1)
1575 std::cout << "run " << irun << std::endl;
1576 //reset training sample from last run
1577 if(verbose>1)
1578 std::cout << "reset training sample from last run" << std::endl;
1579 for(int iclass=0;iclass<nclass;++iclass){
1580 while(testFeatures[iclass].size()){
1581 trainingFeatures[iclass].push_back(testFeatures[iclass].back());
1582 testFeatures[iclass].pop_back();
1583 }
1584 if(verbose>1){
1585 std::cout << "training size " << iclass << ": " << trainingFeatures[iclass].size() << std::endl;
1586 std::cout << "test size " << iclass << ": " << testFeatures[iclass].size() << std::endl;
1587 }
1588 assert(trainingFeatures[iclass].size());
1589 }
1590 //create test sample
1591 if(verbose>1)
1592 std::cout << "create test sample" << std::endl;
1593 unsigned int nsample=0;
1594 int ntest=(cv>1)? ntraining/cv : 1; //n-fold cross validation or leave-one-out
1595 while(nsample<ntest){
1596 // if(index>=trainingFeatures[testclass].size()){
1597 // index=0;
1598 // }
1599 testFeatures[testclass].push_back(trainingFeatures[testclass][0]);
1600 trainingFeatures[testclass].erase(trainingFeatures[testclass].begin());
1601 if(!trainingFeatures[testclass].size())
1602 std::cout << "Error: testclass " << testclass << " has no training" << std::endl;
1603 assert(trainingFeatures[testclass].size());
1604 ++nsample;
1605 if(static_cast<float>(trainingFeatures[testclass].size())/static_cast<float>(testFeatures[testclass].size())<=(cv-1)){
1606 if(verbose>1){
1607 std::cout << "training size " << testclass << ": " << trainingFeatures[testclass].size() << std::endl;
1608 std::cout << "test size " << testclass << ": " << testFeatures[testclass].size() << std::endl;
1609 }
1610 testclass=(testclass+1)%nclass;
1611 }
1612 }
1613 assert(nsample==ntest);
1614 //training with left out training set
1615 if(verbose>1)
1616 std::cout << std::endl << "Set training data" << std::endl;
1617 bool initWeights=true;
1618 unsigned int epochs_between_reports=0;
1619 train_on_data(trainingFeatures,ntraining-ntest,initWeights, max_epochs,
1620 epochs_between_reports, desired_error);
1621 //cross validation with testFeatures
1622 if(verbose>1)
1623 std::cout << std::endl << "Cross validation" << std::endl;
1624
1625 std::vector<float> result(nclass);
1626 int maxClass=-1;
1627 for(int iclass=0;iclass<testFeatures.size();++iclass){
1628 assert(trainingFeatures[iclass].size());
1629 for(int isample=0;isample<testFeatures[iclass].size();++isample){
1630 result=run(testFeatures[iclass][isample]);
1631 //search class with maximum posterior probability
1632 float maxP=-1;
1633 for(int ic=0;ic<nclass;++ic){
1634 float pv=(result[ic]+1.0)/2.0;//bring back to scale [0,1]
1635 if(pv>maxP){
1636 maxP=pv;
1637 maxClass=ic;
1638 }
1639 }
1640 assert(maxP>=0);
1641 referenceVector.push_back(iclass);
1642 outputVector.push_back(maxClass);
1643 }
1644 }
1645
1646 // rmse+=test_data(testFeatures,ntest);
1647 // if(verbose>1)
1648 // std::cout << std::endl << "rmse: " << rmse << std::endl;
1649 }
1650 // rmse/=nrun;
1651 //reset from very last run
1652 for(int iclass=0;iclass<nclass;++iclass){
1653 while(testFeatures[iclass].size()){
1654 trainingFeatures[iclass].push_back(testFeatures[iclass].back());
1655 testFeatures[iclass].pop_back();
1656 }
1657 }
1658 // return(rmse);
1659 return 0;
1660 }

◆ descale_input()

void FANN::neural_net::descale_input ( fann_type *  input_vector)
inline

Definition at line 3834 of file myfann_cpp.h.

3835 {
3836 if (ann != NULL)
3837 {
3838 fann_descale_input(ann, input_vector );
3839 }
3840 }

◆ descale_output()

void FANN::neural_net::descale_output ( fann_type *  output_vector)
inline

Definition at line 3851 of file myfann_cpp.h.

3852 {
3853 if (ann != NULL)
3854 {
3855 fann_descale_output(ann, output_vector );
3856 }
3857 }

◆ descale_train()

void FANN::neural_net::descale_train ( training_data data)
inline

Definition at line 3705 of file myfann_cpp.h.

3706 {
3707 if (ann != NULL)
3708 {
3709 fann_descale_train(ann, data.train_data);
3710 }
3711 }

◆ destroy()

void FANN::neural_net::destroy ( )
inline

Definition at line 1017 of file myfann_cpp.h.

1018 {
1019 if (ann != NULL)
1020 {
1021 user_context *user_data = static_cast<user_context *>(fann_get_user_data(ann));
1022 if (user_data != NULL)
1023 delete user_data;
1024
1025 fann_destroy(ann);
1026 ann = NULL;
1027 }
1028 }

◆ get_activation_function()

activation_function_enum FANN::neural_net::get_activation_function ( int  layer,
int  neuron 
)
inline

Definition at line 2062 of file myfann_cpp.h.

2063 {
2064 unsigned int activation_function = 0;
2065 if (ann != NULL)
2066 {
2067 activation_function = fann_get_activation_function(ann, layer, neuron);
2068 }
2069 return static_cast<activation_function_enum>(activation_function);
2070 }

◆ get_activation_steepness()

fann_type FANN::neural_net::get_activation_steepness ( int  layer,
int  neuron 
)
inline

Definition at line 2192 of file myfann_cpp.h.

2193 {
2194 fann_type activation_steepness = 0;
2195 if (ann != NULL)
2196 {
2197 activation_steepness = fann_get_activation_steepness(ann, layer, neuron);
2198 }
2199 return activation_steepness;
2200 }

◆ get_bias_array()

void FANN::neural_net::get_bias_array ( unsigned int *  bias)
inline

Definition at line 2798 of file myfann_cpp.h.

2799 {
2800 if (ann != NULL)
2801 {
2802 fann_get_bias_array(ann, bias);
2803 }
2804 }

◆ get_bit_fail()

unsigned int FANN::neural_net::get_bit_fail ( )
inline

Definition at line 3040 of file myfann_cpp.h.

3041 {
3042 unsigned int bit_fail = 0;
3043 if (ann != NULL)
3044 {
3045 bit_fail = fann_get_bit_fail(ann);
3046 }
3047 return bit_fail;
3048 }

◆ get_bit_fail_limit()

fann_type FANN::neural_net::get_bit_fail_limit ( )
inline

Definition at line 2997 of file myfann_cpp.h.

2998 {
2999 fann_type bit_fail_limit = 0.0f;
3000
3001 if (ann != NULL)
3002 {
3003 bit_fail_limit = fann_get_bit_fail_limit(ann);
3004 }
3005 return bit_fail_limit;
3006 }

◆ get_cascade_activation_functions()

activation_function_enum * FANN::neural_net::get_cascade_activation_functions ( )
inline

Definition at line 3525 of file myfann_cpp.h.

3526 {
3527 enum fann_activationfunc_enum *activation_functions = NULL;
3528 if (ann != NULL)
3529 {
3530 activation_functions = fann_get_cascade_activation_functions(ann);
3531 }
3532 return reinterpret_cast<activation_function_enum *>(activation_functions);
3533 }

◆ get_cascade_activation_functions_count()

unsigned int FANN::neural_net::get_cascade_activation_functions_count ( )
inline

Definition at line 3501 of file myfann_cpp.h.

3502 {
3503 unsigned int activation_functions_count = 0;
3504 if (ann != NULL)
3505 {
3506 activation_functions_count = fann_get_cascade_activation_functions_count(ann);
3507 }
3508 return activation_functions_count;
3509 }

◆ get_cascade_activation_steepnesses()

fann_type * FANN::neural_net::get_cascade_activation_steepnesses ( )
inline

Definition at line 3598 of file myfann_cpp.h.

3599 {
3600 fann_type *activation_steepnesses = NULL;
3601 if (ann != NULL)
3602 {
3603 activation_steepnesses = fann_get_cascade_activation_steepnesses(ann);
3604 }
3605 return activation_steepnesses;
3606 }

◆ get_cascade_activation_steepnesses_count()

unsigned int FANN::neural_net::get_cascade_activation_steepnesses_count ( )
inline

Definition at line 3572 of file myfann_cpp.h.

3573 {
3574 unsigned int activation_steepness_count = 0;
3575 if (ann != NULL)
3576 {
3577 activation_steepness_count = fann_get_cascade_activation_steepnesses_count(ann);
3578 }
3579 return activation_steepness_count;
3580 }

◆ get_cascade_candidate_change_fraction()

float FANN::neural_net::get_cascade_candidate_change_fraction ( )
inline

Definition at line 3225 of file myfann_cpp.h.

3226 {
3227 float change_fraction = 0.0f;
3228 if (ann != NULL)
3229 {
3230 change_fraction = fann_get_cascade_candidate_change_fraction(ann);
3231 }
3232 return change_fraction;
3233 }

◆ get_cascade_candidate_limit()

fann_type FANN::neural_net::get_cascade_candidate_limit ( )
inline

Definition at line 3351 of file myfann_cpp.h.

3352 {
3353 fann_type candidate_limit = 0;
3354 if (ann != NULL)
3355 {
3356 candidate_limit = fann_get_cascade_candidate_limit(ann);
3357 }
3358 return candidate_limit;
3359 }

◆ get_cascade_candidate_stagnation_epochs()

unsigned int FANN::neural_net::get_cascade_candidate_stagnation_epochs ( )
inline

Definition at line 3268 of file myfann_cpp.h.

3269 {
3270 unsigned int stagnation_epochs = 0;
3271 if (ann != NULL)
3272 {
3273 stagnation_epochs = fann_get_cascade_candidate_stagnation_epochs(ann);
3274 }
3275 return stagnation_epochs;
3276 }

◆ get_cascade_max_cand_epochs()

unsigned int FANN::neural_net::get_cascade_max_cand_epochs ( )
inline

Definition at line 3429 of file myfann_cpp.h.

3430 {
3431 unsigned int max_cand_epochs = 0;
3432 if (ann != NULL)
3433 {
3434 max_cand_epochs = fann_get_cascade_max_cand_epochs(ann);
3435 }
3436 return max_cand_epochs;
3437 }

◆ get_cascade_max_out_epochs()

unsigned int FANN::neural_net::get_cascade_max_out_epochs ( )
inline

Definition at line 3390 of file myfann_cpp.h.

3391 {
3392 unsigned int max_out_epochs = 0;
3393 if (ann != NULL)
3394 {
3395 max_out_epochs = fann_get_cascade_max_out_epochs(ann);
3396 }
3397 return max_out_epochs;
3398 }

◆ get_cascade_num_candidate_groups()

unsigned int FANN::neural_net::get_cascade_num_candidate_groups ( )
inline

Definition at line 3649 of file myfann_cpp.h.

3650 {
3651 unsigned int num_candidate_groups = 0;
3652 if (ann != NULL)
3653 {
3654 num_candidate_groups = fann_get_cascade_num_candidate_groups(ann);
3655 }
3656 return num_candidate_groups;
3657 }

◆ get_cascade_num_candidates()

unsigned int FANN::neural_net::get_cascade_num_candidates ( )
inline

Definition at line 3479 of file myfann_cpp.h.

3480 {
3481 unsigned int num_candidates = 0;
3482 if (ann != NULL)
3483 {
3484 num_candidates = fann_get_cascade_num_candidates(ann);
3485 }
3486 return num_candidates;
3487 }

◆ get_cascade_output_change_fraction()

float FANN::neural_net::get_cascade_output_change_fraction ( )
inline

Definition at line 3133 of file myfann_cpp.h.

3134 {
3135 float change_fraction = 0.0f;
3136 if (ann != NULL)
3137 {
3138 change_fraction = fann_get_cascade_output_change_fraction(ann);
3139 }
3140 return change_fraction;
3141 }

◆ get_cascade_output_stagnation_epochs()

unsigned int FANN::neural_net::get_cascade_output_stagnation_epochs ( )
inline

Definition at line 3175 of file myfann_cpp.h.

3176 {
3177 unsigned int stagnation_epochs = 0;
3178 if (ann != NULL)
3179 {
3180 stagnation_epochs = fann_get_cascade_output_stagnation_epochs(ann);
3181 }
3182 return stagnation_epochs;
3183 }

◆ get_cascade_weight_multiplier()

fann_type FANN::neural_net::get_cascade_weight_multiplier ( )
inline

Definition at line 3309 of file myfann_cpp.h.

3310 {
3311 fann_type weight_multiplier = 0;
3312 if (ann != NULL)
3313 {
3314 weight_multiplier = fann_get_cascade_weight_multiplier(ann);
3315 }
3316 return weight_multiplier;
3317 }

◆ get_connection_array() [1/2]

void FANN::neural_net::get_connection_array ( connection *  connections)
inline

Definition at line 2818 of file myfann_cpp.h.

2819 {
2820 if (ann != NULL)
2821 {
2822 fann_get_connection_array(ann, connections);
2823 }
2824 }

◆ get_connection_array() [2/2]

void FANN::neural_net::get_connection_array ( std::vector< connection > &  convector)
inline

Definition at line 2826 of file myfann_cpp.h.

2827 {
2828 convector.clear();
2829 if (ann != NULL)
2830 {
2831 convector.resize(get_total_connections());
2832 connection* connections=(connection*)calloc(get_total_connections(),sizeof(connection));
2833 fann_get_connection_array(ann, connections);
2834 for(int icon=0;icon<get_total_connections();++icon)
2835 convector[icon]=*(connections++);
2836 }
2837 }

◆ get_connection_rate()

float FANN::neural_net::get_connection_rate ( )
inline

Definition at line 2722 of file myfann_cpp.h.

2723 {
2724 if (ann == NULL)
2725 {
2726 return 0;
2727 }
2728 return fann_get_connection_rate(ann);
2729 }

◆ get_errno()

unsigned int FANN::neural_net::get_errno ( )
inline

Definition at line 3895 of file myfann_cpp.h.

3896 {
3897 return fann_get_errno(reinterpret_cast<struct fann_error *>(ann));
3898 }

◆ get_errstr()

std::string FANN::neural_net::get_errstr ( )
inline

Definition at line 3930 of file myfann_cpp.h.

3931 {
3932 return std::string(fann_get_errstr(reinterpret_cast<struct fann_error *>(ann)));
3933 }

◆ get_layer_array() [1/2]

void FANN::neural_net::get_layer_array ( std::vector< unsigned int >  vlayers)
inline

Definition at line 2774 of file myfann_cpp.h.

2775 {
2776 vlayers.clear();
2777 if (ann != NULL){
2778 vlayers.resize(get_num_layers());
2779 unsigned int* layers=(unsigned int *)calloc(get_num_layers(),sizeof(unsigned int));
2780 fann_get_layer_array(ann, layers);
2781 for(int ilayer=0;ilayer<get_num_layers();++ilayer)
2782 vlayers[ilayer]=*(layers++);
2783 }
2784 }

◆ get_layer_array() [2/2]

void FANN::neural_net::get_layer_array ( unsigned int *  layers)
inline

Definition at line 2766 of file myfann_cpp.h.

2767 {
2768 if (ann != NULL)
2769 {
2770 fann_get_layer_array(ann, layers);
2771 }
2772 }

◆ get_learning_momentum()

float FANN::neural_net::get_learning_momentum ( )
inline

Definition at line 2910 of file myfann_cpp.h.

2911 {
2912 float learning_momentum = 0.0f;
2913 if (ann != NULL)
2914 {
2915 learning_momentum = fann_get_learning_momentum(ann);
2916 }
2917 return learning_momentum;
2918 }

◆ get_learning_rate()

float FANN::neural_net::get_learning_rate ( )
inline

Definition at line 2015 of file myfann_cpp.h.

2016 {
2017 float learning_rate = 0.0f;
2018 if (ann != NULL)
2019 {
2020 learning_rate = fann_get_learning_rate(ann);
2021 }
2022 return learning_rate;
2023 }

◆ get_MSE()

float FANN::neural_net::get_MSE ( )
inline

Definition at line 1876 of file myfann_cpp.h.

1877 {
1878 float mse = 0.0f;
1879 if (ann != NULL)
1880 {
1881 mse = fann_get_MSE(ann);
1882 }
1883 return mse;
1884 }

◆ get_network_type()

network_type_enum FANN::neural_net::get_network_type ( )
inline

Definition at line 2700 of file myfann_cpp.h.

2701 {
2702 fann_nettype_enum network_type = FANN_NETTYPE_LAYER;
2703 if (ann != NULL)
2704 {
2705 network_type = fann_get_network_type(ann);
2706 }
2707 return static_cast<network_type_enum>(network_type);
2708 }

◆ get_num_input()

unsigned int FANN::neural_net::get_num_input ( )
inline

Definition at line 2577 of file myfann_cpp.h.

2578 {
2579 unsigned int num_input = 0;
2580 if (ann != NULL)
2581 {
2582 num_input = fann_get_num_input(ann);
2583 }
2584 return num_input;
2585 }

◆ get_num_layers()

unsigned int FANN::neural_net::get_num_layers ( )
inline

Definition at line 2743 of file myfann_cpp.h.

2744 {
2745 if (ann == NULL)
2746 {
2747 return 0;
2748 }
2749 return fann_get_num_layers(ann);
2750 }

◆ get_num_output()

unsigned int FANN::neural_net::get_num_output ( )
inline

Definition at line 2593 of file myfann_cpp.h.

2594 {
2595 unsigned int num_output = 0;
2596 if (ann != NULL)
2597 {
2598 num_output = fann_get_num_output(ann);
2599 }
2600 return num_output;
2601 }

◆ get_quickprop_decay()

float FANN::neural_net::get_quickprop_decay ( )
inline

Definition at line 2351 of file myfann_cpp.h.

2352 {
2353 float quickprop_decay = 0.0f;
2354 if (ann != NULL)
2355 {
2356 quickprop_decay = fann_get_quickprop_decay(ann);
2357 }
2358 return quickprop_decay;
2359 }

◆ get_quickprop_mu()

float FANN::neural_net::get_quickprop_mu ( )
inline

Definition at line 2391 of file myfann_cpp.h.

2392 {
2393 float quickprop_mu = 0.0f;
2394 if (ann != NULL)
2395 {
2396 quickprop_mu = fann_get_quickprop_mu(ann);
2397 }
2398 return quickprop_mu;
2399 }

◆ get_rprop_decrease_factor()

float FANN::neural_net::get_rprop_decrease_factor ( )
inline

Definition at line 2468 of file myfann_cpp.h.

2469 {
2470 float factor = 0.0f;
2471 if (ann != NULL)
2472 {
2473 factor = fann_get_rprop_decrease_factor(ann);
2474 }
2475 return factor;
2476 }

◆ get_rprop_delta_max()

float FANN::neural_net::get_rprop_delta_max ( )
inline

Definition at line 2544 of file myfann_cpp.h.

2545 {
2546 float delta = 0.0f;
2547 if (ann != NULL)
2548 {
2549 delta = fann_get_rprop_delta_max(ann);
2550 }
2551 return delta;
2552 }

◆ get_rprop_delta_min()

float FANN::neural_net::get_rprop_delta_min ( )
inline

Definition at line 2506 of file myfann_cpp.h.

2507 {
2508 float delta = 0.0f;
2509 if (ann != NULL)
2510 {
2511 delta = fann_get_rprop_delta_min(ann);
2512 }
2513 return delta;
2514 }

◆ get_rprop_increase_factor()

float FANN::neural_net::get_rprop_increase_factor ( )
inline

Definition at line 2430 of file myfann_cpp.h.

2431 {
2432 float factor = 0.0f;
2433 if (ann != NULL)
2434 {
2435 factor = fann_get_rprop_increase_factor(ann);
2436 }
2437 return factor;
2438 }

◆ get_total_connections()

unsigned int FANN::neural_net::get_total_connections ( )
inline

Definition at line 2625 of file myfann_cpp.h.

2626 {
2627 if (ann == NULL)
2628 {
2629 return 0;
2630 }
2631 return fann_get_total_connections(ann);
2632 }

◆ get_total_neurons()

unsigned int FANN::neural_net::get_total_neurons ( )
inline

Definition at line 2610 of file myfann_cpp.h.

2611 {
2612 if (ann == NULL)
2613 {
2614 return 0;
2615 }
2616 return fann_get_total_neurons(ann);
2617 }

◆ get_train_error_function()

error_function_enum FANN::neural_net::get_train_error_function ( )
inline

Definition at line 2308 of file myfann_cpp.h.

2309 {
2310 fann_errorfunc_enum train_error_function = FANN_ERRORFUNC_LINEAR;
2311 if (ann != NULL)
2312 {
2313 train_error_function = fann_get_train_error_function(ann);
2314 }
2315 return static_cast<error_function_enum>(train_error_function);
2316 }

◆ get_train_stop_function()

stop_function_enum FANN::neural_net::get_train_stop_function ( )
inline

Definition at line 2949 of file myfann_cpp.h.

2950 {
2951 enum fann_stopfunc_enum stopfunc = FANN_STOPFUNC_MSE;
2952 if (ann != NULL)
2953 {
2954 stopfunc = fann_get_train_stop_function(ann);
2955 }
2956 return static_cast<stop_function_enum>(stopfunc);
2957 }

◆ get_training_algorithm()

training_algorithm_enum FANN::neural_net::get_training_algorithm ( )
inline

Definition at line 1972 of file myfann_cpp.h.

1973 {
1974 fann_train_enum training_algorithm = FANN_TRAIN_INCREMENTAL;
1975 if (ann != NULL)
1976 {
1977 training_algorithm = fann_get_training_algorithm(ann);
1978 }
1979 return static_cast<training_algorithm_enum>(training_algorithm);
1980 }

◆ init_weights()

void FANN::neural_net::init_weights ( const training_data data)
inline

Definition at line 1288 of file myfann_cpp.h.

1289 {
1290 if ((ann != NULL) && (data.train_data != NULL))
1291 {
1292 fann_init_weights(ann, data.train_data);
1293 }
1294 }

◆ print_connections()

void FANN::neural_net::print_connections ( )
inline

Definition at line 1322 of file myfann_cpp.h.

1323 {
1324 if (ann != NULL)
1325 {
1326 fann_print_connections(ann);
1327 }
1328 }

◆ print_error()

void FANN::neural_net::print_error ( )
inline

Definition at line 3941 of file myfann_cpp.h.

3942 {
3943 fann_print_error(reinterpret_cast<struct fann_error *>(ann));
3944 }

◆ print_parameters()

void FANN::neural_net::print_parameters ( )
inline

Definition at line 1948 of file myfann_cpp.h.

1949 {
1950 if (ann != NULL)
1951 {
1952 fann_print_parameters(ann);
1953 }
1954 }

◆ randomize_weights()

void FANN::neural_net::randomize_weights ( fann_type  min_weight,
fann_type  max_weight 
)
inline

Definition at line 1261 of file myfann_cpp.h.

1262 {
1263 if (ann != NULL)
1264 {
1265 fann_randomize_weights(ann, min_weight, max_weight);
1266 }
1267 }

◆ reset_errno()

void FANN::neural_net::reset_errno ( )
inline

Definition at line 3906 of file myfann_cpp.h.

3907 {
3908 fann_reset_errno(reinterpret_cast<struct fann_error *>(ann));
3909 }

◆ reset_errstr()

void FANN::neural_net::reset_errstr ( )
inline

Definition at line 3917 of file myfann_cpp.h.

3918 {
3919 fann_reset_errstr(reinterpret_cast<struct fann_error *>(ann));
3920 }

◆ reset_MSE()

void FANN::neural_net::reset_MSE ( )
inline

Definition at line 1897 of file myfann_cpp.h.

1898 {
1899 if (ann != NULL)
1900 {
1901 fann_reset_MSE(ann);
1902 }
1903 }

◆ run() [1/2]

fann_type * FANN::neural_net::run ( fann_type *  input)
inline

Definition at line 1223 of file myfann_cpp.h.

1224 {
1225 if (ann == NULL)
1226 {
1227 return NULL;
1228 }
1229// for(int iband=0;iband<get_num_input();++iband)
1230// std::cout << (input)[iband] << " ";
1231// std::cout << std::endl;
1232 return fann_run(ann, input);
1233 }

◆ run() [2/2]

std::vector< fann_type > FANN::neural_net::run ( std::vector< fann_type >  input)
inline

Definition at line 1235 of file myfann_cpp.h.

1236 {
1237 std::vector<fann_type> vresult;
1238 if (ann == NULL)
1239 {
1240 return vresult;
1241 }
1242 vresult.resize(get_num_output());
1243 fann_type* result;
1244 result=fann_run(ann,&(input[0]));
1245 for(int iout=0;iout<get_num_output();++iout)
1246 vresult[iout]=*(result++);
1247 return vresult;
1248 }

◆ save()

bool FANN::neural_net::save ( const std::string &  configuration_file)
inline

Definition at line 1367 of file myfann_cpp.h.

1368 {
1369 if (ann == NULL)
1370 {
1371 return false;
1372 }
1373 if (fann_save(ann, configuration_file.c_str()) == -1)
1374 {
1375 return false;
1376 }
1377 return true;
1378 }

◆ save_to_fixed()

int FANN::neural_net::save_to_fixed ( const std::string &  configuration_file)
inline

Definition at line 1412 of file myfann_cpp.h.

1413 {
1414 int fixpoint = 0;
1415 if (ann != NULL)
1416 {
1417 fixpoint = fann_save_to_fixed(ann, configuration_file.c_str());
1418 }
1419 return fixpoint;
1420 }

◆ scale_input()

void FANN::neural_net::scale_input ( fann_type *  input_vector)
inline

Definition at line 3800 of file myfann_cpp.h.

3801 {
3802 if (ann != NULL)
3803 {
3804 fann_scale_input(ann, input_vector );
3805 }
3806 }

◆ scale_output()

void FANN::neural_net::scale_output ( fann_type *  output_vector)
inline

Definition at line 3817 of file myfann_cpp.h.

3818 {
3819 if (ann != NULL)
3820 {
3821 fann_scale_output(ann, output_vector );
3822 }
3823 }

◆ scale_train()

void FANN::neural_net::scale_train ( training_data data)
inline

Definition at line 3688 of file myfann_cpp.h.

3689 {
3690 if (ann != NULL)
3691 {
3692 fann_scale_train(ann, data.train_data);
3693 }
3694 }

◆ set_activation_function()

void FANN::neural_net::set_activation_function ( activation_function_enum  activation_function,
int  layer,
int  neuron 
)
inline

Definition at line 2094 of file myfann_cpp.h.

2095 {
2096 if (ann != NULL)
2097 {
2098 fann_set_activation_function(ann,
2099 static_cast<fann_activationfunc_enum>(activation_function), layer, neuron);
2100 }
2101 }

◆ set_activation_function_hidden()

void FANN::neural_net::set_activation_function_hidden ( activation_function_enum  activation_function)
inline

Definition at line 2137 of file myfann_cpp.h.

2138 {
2139 if (ann != NULL)
2140 {
2141 fann_set_activation_function_hidden(ann,
2142 static_cast<fann_activationfunc_enum>(activation_function));
2143 }
2144 }

◆ set_activation_function_layer()

void FANN::neural_net::set_activation_function_layer ( activation_function_enum  activation_function,
int  layer 
)
inline

Definition at line 2117 of file myfann_cpp.h.

2118 {
2119 if (ann != NULL)
2120 {
2121 fann_set_activation_function_layer(ann,
2122 static_cast<fann_activationfunc_enum>(activation_function), layer);
2123 }
2124 }

◆ set_activation_function_output()

void FANN::neural_net::set_activation_function_output ( activation_function_enum  activation_function)
inline

Definition at line 2157 of file myfann_cpp.h.

2158 {
2159 if (ann != NULL)
2160 {
2161 fann_set_activation_function_output(ann,
2162 static_cast<fann_activationfunc_enum>(activation_function));
2163 }
2164 }

◆ set_activation_steepness()

void FANN::neural_net::set_activation_steepness ( fann_type  steepness,
int  layer,
int  neuron 
)
inline

Definition at line 2225 of file myfann_cpp.h.

2226 {
2227 if (ann != NULL)
2228 {
2229 fann_set_activation_steepness(ann, steepness, layer, neuron);
2230 }
2231 }

◆ set_activation_steepness_hidden()

void FANN::neural_net::set_activation_steepness_hidden ( fann_type  steepness)
inline

Definition at line 2266 of file myfann_cpp.h.

2267 {
2268 if (ann != NULL)
2269 {
2270 fann_set_activation_steepness_hidden(ann, steepness);
2271 }
2272 }

◆ set_activation_steepness_layer()

void FANN::neural_net::set_activation_steepness_layer ( fann_type  steepness,
int  layer 
)
inline

Definition at line 2247 of file myfann_cpp.h.

2248 {
2249 if (ann != NULL)
2250 {
2251 fann_set_activation_steepness_layer(ann, steepness, layer);
2252 }
2253 }

◆ set_activation_steepness_output()

void FANN::neural_net::set_activation_steepness_output ( fann_type  steepness)
inline

Definition at line 2285 of file myfann_cpp.h.

2286 {
2287 if (ann != NULL)
2288 {
2289 fann_set_activation_steepness_output(ann, steepness);
2290 }
2291 }

◆ set_bit_fail_limit()

void FANN::neural_net::set_bit_fail_limit ( fann_type  bit_fail_limit)
inline

Definition at line 3017 of file myfann_cpp.h.

3018 {
3019 if (ann != NULL)
3020 {
3021 fann_set_bit_fail_limit(ann, bit_fail_limit);
3022 }
3023 }

◆ set_callback()

void FANN::neural_net::set_callback ( callback_type  callback,
void *  user_data 
)
inline

Definition at line 1917 of file myfann_cpp.h.

1918 {
1919 if (ann != NULL)
1920 {
1921 // Allocated data is also deleted in the destroy method called by the destructor
1922 user_context *user_instance = static_cast<user_context *>(fann_get_user_data(ann));
1923 if (user_instance != NULL)
1924 delete user_instance;
1925
1926 user_instance = new user_context();
1927 user_instance->user_callback = callback;
1928 user_instance->user_data = user_data;
1929 user_instance->net = this;
1930 fann_set_user_data(ann, user_instance);
1931
1932 if (callback != NULL)
1933 fann_set_callback(ann, &FANN::neural_net::internal_callback);
1934 else
1935 fann_set_callback(ann, NULL);
1936 }
1937 }

◆ set_cascade_activation_functions()

void FANN::neural_net::set_cascade_activation_functions ( activation_function_enum *  cascade_activation_functions,
unsigned int  cascade_activation_functions_count 
)
inline

Definition at line 3549 of file myfann_cpp.h.

3551 {
3552 if (ann != NULL)
3553 {
3554 fann_set_cascade_activation_functions(ann,
3555 reinterpret_cast<enum fann_activationfunc_enum *>(cascade_activation_functions),
3556 cascade_activation_functions_count);
3557 }
3558 }

◆ set_cascade_activation_steepnesses()

void FANN::neural_net::set_cascade_activation_steepnesses ( fann_type *  cascade_activation_steepnesses,
unsigned int  cascade_activation_steepnesses_count 
)
inline

Definition at line 3622 of file myfann_cpp.h.

3624 {
3625 if (ann != NULL)
3626 {
3627 fann_set_cascade_activation_steepnesses(ann,
3628 cascade_activation_steepnesses, cascade_activation_steepnesses_count);
3629 }
3630 }

◆ set_cascade_candidate_change_fraction()

void FANN::neural_net::set_cascade_candidate_change_fraction ( float  cascade_candidate_change_fraction)
inline

Definition at line 3245 of file myfann_cpp.h.

3246 {
3247 if (ann != NULL)
3248 {
3249 fann_set_cascade_candidate_change_fraction(ann, cascade_candidate_change_fraction);
3250 }
3251 }

◆ set_cascade_candidate_limit()

void FANN::neural_net::set_cascade_candidate_limit ( fann_type  cascade_candidate_limit)
inline

Definition at line 3370 of file myfann_cpp.h.

3371 {
3372 if (ann != NULL)
3373 {
3374 fann_set_cascade_candidate_limit(ann, cascade_candidate_limit);
3375 }
3376 }

◆ set_cascade_candidate_stagnation_epochs()

void FANN::neural_net::set_cascade_candidate_stagnation_epochs ( unsigned int  cascade_candidate_stagnation_epochs)
inline

Definition at line 3288 of file myfann_cpp.h.

3289 {
3290 if (ann != NULL)
3291 {
3292 fann_set_cascade_candidate_stagnation_epochs(ann, cascade_candidate_stagnation_epochs);
3293 }
3294 }

◆ set_cascade_max_cand_epochs()

void FANN::neural_net::set_cascade_max_cand_epochs ( unsigned int  cascade_max_cand_epochs)
inline

Definition at line 3448 of file myfann_cpp.h.

3449 {
3450 if (ann != NULL)
3451 {
3452 fann_set_cascade_max_cand_epochs(ann, cascade_max_cand_epochs);
3453 }
3454 }

◆ set_cascade_max_out_epochs()

void FANN::neural_net::set_cascade_max_out_epochs ( unsigned int  cascade_max_out_epochs)
inline

Definition at line 3409 of file myfann_cpp.h.

3410 {
3411 if (ann != NULL)
3412 {
3413 fann_set_cascade_max_out_epochs(ann, cascade_max_out_epochs);
3414 }
3415 }

◆ set_cascade_num_candidate_groups()

void FANN::neural_net::set_cascade_num_candidate_groups ( unsigned int  cascade_num_candidate_groups)
inline

Definition at line 3668 of file myfann_cpp.h.

3669 {
3670 if (ann != NULL)
3671 {
3672 fann_set_cascade_num_candidate_groups(ann, cascade_num_candidate_groups);
3673 }
3674 }

◆ set_cascade_output_change_fraction()

void FANN::neural_net::set_cascade_output_change_fraction ( float  cascade_output_change_fraction)
inline

Definition at line 3152 of file myfann_cpp.h.

3153 {
3154 if (ann != NULL)
3155 {
3156 fann_set_cascade_output_change_fraction(ann, cascade_output_change_fraction);
3157 }
3158 }

◆ set_cascade_output_stagnation_epochs()

void FANN::neural_net::set_cascade_output_stagnation_epochs ( unsigned int  cascade_output_stagnation_epochs)
inline

Definition at line 3194 of file myfann_cpp.h.

3195 {
3196 if (ann != NULL)
3197 {
3198 fann_set_cascade_output_stagnation_epochs(ann, cascade_output_stagnation_epochs);
3199 }
3200 }

◆ set_cascade_weight_multiplier()

void FANN::neural_net::set_cascade_weight_multiplier ( fann_type  cascade_weight_multiplier)
inline

Definition at line 3328 of file myfann_cpp.h.

3329 {
3330 if (ann != NULL)
3331 {
3332 fann_set_cascade_weight_multiplier(ann, cascade_weight_multiplier);
3333 }
3334 }

◆ set_error_log()

void FANN::neural_net::set_error_log ( FILE *  log_file)
inline

Definition at line 3881 of file myfann_cpp.h.

3882 {
3883 fann_set_error_log(reinterpret_cast<struct fann_error *>(ann), log_file);
3884 }

◆ set_input_scaling_params()

bool FANN::neural_net::set_input_scaling_params ( const training_data data,
float  new_input_min,
float  new_input_max 
)
inline

Definition at line 3722 of file myfann_cpp.h.

3723 {
3724 bool status = false;
3725 if (ann != NULL)
3726 {
3727 status = (fann_set_input_scaling_params(ann, data.train_data, new_input_min, new_input_max) != -1);
3728 }
3729 return status;
3730 }

◆ set_learning_momentum()

void FANN::neural_net::set_learning_momentum ( float  learning_momentum)
inline

Definition at line 2928 of file myfann_cpp.h.

2929 {
2930 if (ann != NULL)
2931 {
2932 fann_set_learning_momentum(ann, learning_momentum);
2933 }
2934 }

◆ set_learning_rate()

void FANN::neural_net::set_learning_rate ( float  learning_rate)
inline

Definition at line 2033 of file myfann_cpp.h.

2034 {
2035 if (ann != NULL)
2036 {
2037 fann_set_learning_rate(ann, learning_rate);
2038 }
2039 }

◆ set_output_scaling_params()

bool FANN::neural_net::set_output_scaling_params ( const training_data data,
float  new_output_min,
float  new_output_max 
)
inline

Definition at line 3741 of file myfann_cpp.h.

3742 {
3743 bool status = false;
3744 if (ann != NULL)
3745 {
3746 status = (fann_set_output_scaling_params(ann, data.train_data, new_output_min, new_output_max) != -1);
3747 }
3748 return status;
3749 }

◆ set_quickprop_decay()

void FANN::neural_net::set_quickprop_decay ( float  quickprop_decay)
inline

Definition at line 2370 of file myfann_cpp.h.

2371 {
2372 if (ann != NULL)
2373 {
2374 fann_set_quickprop_decay(ann, quickprop_decay);
2375 }
2376 }

◆ set_quickprop_mu()

void FANN::neural_net::set_quickprop_mu ( float  quickprop_mu)
inline

Definition at line 2410 of file myfann_cpp.h.

2411 {
2412 if (ann != NULL)
2413 {
2414 fann_set_quickprop_mu(ann, quickprop_mu);
2415 }
2416 }

◆ set_rprop_decrease_factor()

void FANN::neural_net::set_rprop_decrease_factor ( float  rprop_decrease_factor)
inline

Definition at line 2487 of file myfann_cpp.h.

2488 {
2489 if (ann != NULL)
2490 {
2491 fann_set_rprop_decrease_factor(ann, rprop_decrease_factor);
2492 }
2493 }

◆ set_rprop_delta_max()

void FANN::neural_net::set_rprop_delta_max ( float  rprop_delta_max)
inline

Definition at line 2563 of file myfann_cpp.h.

2564 {
2565 if (ann != NULL)
2566 {
2567 fann_set_rprop_delta_max(ann, rprop_delta_max);
2568 }
2569 }

◆ set_rprop_delta_min()

void FANN::neural_net::set_rprop_delta_min ( float  rprop_delta_min)
inline

Definition at line 2525 of file myfann_cpp.h.

2526 {
2527 if (ann != NULL)
2528 {
2529 fann_set_rprop_delta_min(ann, rprop_delta_min);
2530 }
2531 }

◆ set_rprop_increase_factor()

void FANN::neural_net::set_rprop_increase_factor ( float  rprop_increase_factor)
inline

Definition at line 2449 of file myfann_cpp.h.

2450 {
2451 if (ann != NULL)
2452 {
2453 fann_set_rprop_increase_factor(ann, rprop_increase_factor);
2454 }
2455 }

◆ set_scaling_params()

bool FANN::neural_net::set_scaling_params ( const training_data data,
float  new_input_min,
float  new_input_max,
float  new_output_min,
float  new_output_max 
)
inline

Definition at line 3760 of file myfann_cpp.h.

3762 {
3763 bool status = false;
3764 if (ann != NULL)
3765 {
3766 status = (fann_set_scaling_params(ann, data.train_data,
3767 new_input_min, new_input_max, new_output_min, new_output_max) != -1);
3768 }
3769 return status;
3770 }

◆ set_train_error_function()

void FANN::neural_net::set_train_error_function ( error_function_enum  train_error_function)
inline

Definition at line 2329 of file myfann_cpp.h.

2330 {
2331 if (ann != NULL)
2332 {
2333 fann_set_train_error_function(ann,
2334 static_cast<fann_errorfunc_enum>(train_error_function));
2335 }
2336 }

◆ set_train_stop_function()

void FANN::neural_net::set_train_stop_function ( stop_function_enum  train_stop_function)
inline

Definition at line 2970 of file myfann_cpp.h.

2971 {
2972 if (ann != NULL)
2973 {
2974 fann_set_train_stop_function(ann,
2975 static_cast<enum fann_stopfunc_enum>(train_stop_function));
2976 }
2977 }

◆ set_training_algorithm()

void FANN::neural_net::set_training_algorithm ( training_algorithm_enum  training_algorithm)
inline

Definition at line 1990 of file myfann_cpp.h.

1991 {
1992 if (ann != NULL)
1993 {
1994 fann_set_training_algorithm(ann,
1995 static_cast<fann_train_enum>(training_algorithm));
1996 }
1997 }

◆ set_weight()

void FANN::neural_net::set_weight ( unsigned int  from_neuron,
unsigned int  to_neuron,
fann_type  weight 
)
inline

Definition at line 2884 of file myfann_cpp.h.

2885 {
2886 if (ann != NULL)
2887 {
2888 fann_set_weight(ann, from_neuron, to_neuron, weight);
2889 }
2890 }

◆ set_weight_array() [1/2]

void FANN::neural_net::set_weight_array ( connection *  connections,
unsigned int  num_connections 
)
inline

Definition at line 2853 of file myfann_cpp.h.

2854 {
2855 if (ann != NULL)
2856 {
2857 fann_set_weight_array(ann, connections, num_connections);
2858 }
2859 }

◆ set_weight_array() [2/2]

void FANN::neural_net::set_weight_array ( std::vector< connection >  convector)
inline

Definition at line 2861 of file myfann_cpp.h.

2862 {
2863 if (ann != NULL)
2864 {
2865 unsigned int num_connections=convector.size();
2866 connection* connections=(connection*)calloc(num_connections,sizeof(connection));
2867 connections=&(convector[0]);
2868 fann_set_weight_array(ann, connections, num_connections);
2869 }
2870 }

◆ test()

fann_type * FANN::neural_net::test ( fann_type *  input,
fann_type *  desired_output 
)
inline

Definition at line 1785 of file myfann_cpp.h.

1786 {
1787 fann_type * output = NULL;
1788 if (ann != NULL)
1789 {
1790 output = fann_test(ann, input, desired_output);
1791 }
1792 return output;
1793 }

◆ test_data() [1/2]

float FANN::neural_net::test_data ( const std::vector< Vector2d< fann_type > > &  input,
unsigned int  num_data 
)
inline

Definition at line 1816 of file myfann_cpp.h.

1817 {
1818 assert(num_data);
1819 assert(input.size());
1820 unsigned int num_class=input.size();
1821 assert(input[0].size());
1822 unsigned int num_input=input[0][0].size();
1823 unsigned int num_output=num_class;
1824 struct fann_train_data *data =
1825 (struct fann_train_data *)malloc(sizeof(struct fann_train_data));
1826 data->input = (fann_type **)calloc(num_data, sizeof(fann_type *));
1827 data->output = (fann_type **)calloc(num_data, sizeof(fann_type *));
1828
1829 data->num_data = num_data;
1830 data->num_input = num_input;
1831 data->num_output = num_output;
1832
1833 fann_type *data_input = (fann_type *)calloc(num_input*num_data, sizeof(fann_type));
1834 fann_type *data_output = (fann_type *)calloc(num_output*num_data, sizeof(fann_type));
1835
1836 unsigned int isample=0;
1837 for(int iclass=0;iclass<num_class;++iclass){
1838 for(int csample=0;csample<input[iclass].size();++csample){
1839 data->input[isample] = data_input;
1840 data_input += num_input;
1841 for(int iband=0;iband<input[iclass][csample].size();++iband){
1842 assert(input[iclass][csample].size()==num_input);
1843 data->input[isample][iband] = input[iclass][csample][iband];
1844 }
1845 data->output[isample] = data_output;
1846 data_output += num_output;
1847 for(int ic=0;ic<num_output;++ic){
1848 //for single neuron output:
1849// data->output[isample][ic]=2.0/(num_class-1)*(iclass-(num_class-1)/2.0);
1850 if(ic==iclass)
1851 data->output[isample][ic] = 1;
1852 else
1853 data->output[isample][ic] = -1;
1854 }
1855 ++isample;
1856 }
1857 }
1858 FANN::training_data trainingData;
1859 trainingData.train_data = data;
1860 return test_data(trainingData);
1861 }

◆ test_data() [2/2]

float FANN::neural_net::test_data ( const training_data data)
inline

Definition at line 1806 of file myfann_cpp.h.

1807 {
1808 float mse = 0.0f;
1809 if ((ann != NULL) && (data.train_data != NULL))
1810 {
1811 mse = fann_test_data(ann, data.train_data);
1812 }
1813 return mse;
1814 }

◆ train()

void FANN::neural_net::train ( fann_type *  input,
fann_type *  desired_output 
)
inline

Definition at line 1439 of file myfann_cpp.h.

1440 {
1441 if (ann != NULL)
1442 {
1443 fann_train(ann, input, desired_output);
1444 }
1445 }

◆ train_epoch()

float FANN::neural_net::train_epoch ( const training_data data)
inline

Definition at line 1466 of file myfann_cpp.h.

1467 {
1468 float mse = 0.0f;
1469 if ((ann != NULL) && (data.train_data != NULL))
1470 {
1471 mse = fann_train_epoch(ann, data.train_data);
1472 }
1473 return mse;
1474 }

◆ train_on_data() [1/3]

void FANN::neural_net::train_on_data ( const std::vector< std::vector< fann_type > > &  input,
const std::vector< std::vector< fann_type > > &  output,
bool  initWeights,
unsigned int  max_epochs,
unsigned int  epochs_between_reports,
float  desired_error 
)
inline

Definition at line 1512 of file myfann_cpp.h.

1518 {
1519 if ((ann != NULL))
1520 {
1521 training_data data;
1522 data.set_train_data(input,output);
1523 if(data.train_data != NULL){
1524 if(initWeights)
1525 init_weights(data);
1526 fann_train_on_data(ann, data.train_data, max_epochs,
1527 epochs_between_reports, desired_error);
1528 }
1529 }
1530 }

◆ train_on_data() [2/3]

void FANN::neural_net::train_on_data ( const std::vector< Vector2d< fann_type > > &  input,
unsigned int  num_data,
bool  initWeights,
unsigned int  max_epochs,
unsigned int  epochs_between_reports,
float  desired_error 
)
inline

Definition at line 1532 of file myfann_cpp.h.

1538 {
1539 if ((ann != NULL))
1540 {
1541 training_data data;
1542 data.set_train_data(input,num_data);
1543 if(data.train_data != NULL){
1544 if(initWeights)
1545 init_weights(data);
1546 fann_train_on_data(ann, data.train_data, max_epochs,
1547 epochs_between_reports, desired_error);
1548 }
1549 }
1550 }

◆ train_on_data() [3/3]

void FANN::neural_net::train_on_data ( const training_data data,
unsigned int  max_epochs,
unsigned int  epochs_between_reports,
float  desired_error 
)
inline

Definition at line 1500 of file myfann_cpp.h.

1502 {
1503 if ((ann != NULL) && (data.train_data != NULL))
1504 {
1505 fann_train_on_data(ann, data.train_data, max_epochs,
1506 epochs_between_reports, desired_error);
1507 }
1508 }

◆ train_on_file()

void FANN::neural_net::train_on_file ( const std::string &  filename,
unsigned int  max_epochs,
unsigned int  epochs_between_reports,
float  desired_error 
)
inline

Definition at line 1763 of file myfann_cpp.h.

1765 {
1766 if (ann != NULL)
1767 {
1768 fann_train_on_file(ann, filename.c_str(),
1769 max_epochs, epochs_between_reports, desired_error);
1770 }
1771 }

Member Data Documentation

◆ ann

struct fann* FANN::neural_net::ann
protected

Definition at line 3980 of file myfann_cpp.h.


The documentation for this class was generated from the following file: