class OneLayer |
Simple perceptron - HTML documentation under construction.
![]() | OneLayer () Default constructor it does nothing. |
![]() | OneLayer (unsigned nout, unsigned nin, act_func fout=sigmoid) Constructor It builds a one layer perceptron with nout output units, nin input units and fout activation function. |
![]() | OneLayer (unsigned dummy) Constructor It builds only the codex matrix and initiailizes the queue of historical errors |
![]() | ~OneLayer () Destructor |
![]() | init_weights_norm (int s = 0) initializes all values according to a noraml distribution centerd in 0 with unitary standard deviation |
![]() | init_weights_const (double x) initializes all values to x |
![]() | read_weights (char* namefile) It reads a matrix of weights The matrix is read from the file namefile. |
![]() | print_weights (void) It prints on stdout the weight matrix |
![]() | compute (vect& vinput) It computes the output vector of the net |
![]() | predictclassWTA (vect& vinput) It outputs the predicted class (WTA criterion) Given an input vector, it predict a class using the winner-takes-all criterion. |
![]() | predictclass (vect& vinput) It outputs the predicted class (min. |
![]() | backprop (vect& t, vect& x) It computes the error gradient of the net. |
![]() | print_info_grad (void) It outputs the delta values, ie. |
![]() | print_C (void) It prints on stdout the decomposition matrix C |
![]() | save_weights (char* namefile) It saves onto a file the weights and the paramenters of the net It saves onto the file namefilenet the parameters of the net and its weights File format: "Version: " version number (unsigned) (actually always 1) namefile (string) "Number_layers: " Layers number (unsigned) "Dim_output: " Output layer size (unsigned) "Actfunction: " Number of the activation function (unsigned) "Dim_hidden1: " I hidden layer size (unsigned) "Actfunction: " Number of the activation function (unsigned) present if number layers > 1 "Dim_hidden2: " II hidden layer size (unsigned) "Actfunction: " Number of the activation function (unsigned) present if number layers > 2 "Dim_input: " Input size (unsigned) "Weight matrix first layer :" Weight matrix output layer (double) "Bias vector :" Bias vector output layer (double) "Weight matrix first hidden layer :" present if number layers > 1 Matrix (matrix of double) present if number layers > 1 "Bias vector :" present if number layers > 1 Vector (vector of double) present if number layers > 1 "Weight matrix second hidden layer :" present if number layers > 2 Matrix (matrix of double) present if number layers > 2 "Bias vector :" present if number layers > 2 Vector (vector of double) present if number layers > 2 "END" File termination string NOTE : the activation function can be: SIGMOID = 1, TANHYP = 2, IDENTITY = 3. |
![]() | read_qerror () It returns the queue of the historical errors along the epochs. |
![]() | save_errors (char* file) |
![]() | Learn_by_pattern (TrainingSet& t_set, Learning& learn, unsigned& iter, double& error, double errtol = ERR_TOL, unsigned maxits = MAXITS, bool printout = true) |
![]() | Learn_by_epoch (TrainingSet& t_set, Learning& learn, unsigned& iter, double& error, double errtol = ERR_TOL, unsigned maxits = MAXITS, bool printout = true) |
![]() | test (TrainingSet& tset) Testing the neural net It performs the testing of the net on the testing set tset. |
![]() | test (TrainingSet& tset, deque<unsigned>& outputs) Testing the neural net It performs the testing of the net on the testing set tset. |
![]() | save_out (TrainingSet& tset, char* file) |
![]() | save_out (TrainingSet& tset, ofstream& f) It saves onto a stream the outputs of the net File format: y1 y2 . |
![]() | save_predicted (deque<unsigned>& outputs, char* file) Saves onto a file the classes predicted by the net The labels are stored one for each line. |
![]() | save_decomp_matrix (ofstream& f) |
![]() | CrossValidate (char* name, unsigned nfold, unsigned num_attr, char* filerr, LearnType& learninfo, char* savecvfile = "", char* readcvfile = "", char* outfile = "", int saveout = 0, int seed=0, bool printout=true) |
![]() | CrossValidateTrialWeights (char* name, unsigned nfold, unsigned num_attr, char* filerr, LearnType& learninfo, char* outfile = "", int saveout = 0, int seed=0, int times=3, bool printout=true) |
![]() | SaveCV (char* name, vector<unsigned>& iter, vect& abserr, vect& percerr, unsigned ntrain, matrix& conf, clock_t start, clock_t end) |
![]() | print_resultCV (vector<unsigned>& iter, vect& abserr, vect& percerr, unsigned ntrain, clock_t start, clock_t end) |
![]() | print_errors () |
![]() | Code_act_fun (act_func g) |
![]() | Decode_act_fun (unsigned fun) |
![]() | Read_seed (void) It returns the the random initialization seed for the weights |
![]() | get_perc_errors (void) Return the testing percentual of errors. |
![]() | Read_minHam (void) |
![]() | Activation, deactivation and threshold values with respectively sigmoid, hyperbolic tangent |
![]() | ERR_PRECISION precision by which are saved error in the stream |
![]() | OUTPUT_PRECISION precision of the net output in the stream |
![]() | MAXITS default value of max. |
![]() | ERR_TOL default value of the tolerated RMS value |
![]() | INTEST_SIZE width of the heading field of the file for saving weigths |
![]() | n_class Cardinality of the classes |
![]() | C Codex matrix one-per-class of dimension n_outputs * n_class Ith column correspond to the codeword of the class i+1; Matrix values are determined by the activation function used by the net. |
![]() | layer [MAXLAYERS] Layers of the neurons. |
![]() | Qerror Queue for recording the errors sequence of the net along the epochs |
![]() | num_errors Number of testing errors |
![]() | perc_errors Percentual of testing errors |
![]() | seed Random initialization seed for the weights |
![]() | minHam Minimum Hamming distance among codewords of the classes |
![]() | Init_C (void) |
![]() | analyze (act_func g, double& on, double& off) |
![]() | Calc_square_error (vect& t, vect& out) |
![]() | calc_denom_RMS (vect& t, unsigned n_train) |
![]() | RMS_error (double err, double denom) |
![]() | read_weights (istream& f) |
![]() | save_weights_heading (char* namefile) It saves onto a file the general paramenters of the net It saves the number of layers, size of the layers and type of the activation function |
![]() | save_weights_heading (ofstream& f, char* namebuf) It saves in a stream the general paramenters of the net It saves the number of layers, size of the layers and type of the activation function |
![]() | save_weights_body (char* namefile) It appends onto a file the weights of the net. |
![]() | save_weights_body (ofstream& f) It appends to a stream the weights of the net. |
![]() | save_weights_cv_heading (char* savecvfile, int nfold) It saves onto a file the general paramenters of the nets of the cross validation It saves the number of layers, size of the layers and type of the activation function |
![]() | save_weights_cv_body (char* namefile, int fold_n) It appends onto a file the weights of the net of the cross validation. |
![]() | do_Sum_deltas (unsigned n_layers, matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | Update_Sum_Delta (unsigned n_layers, matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | Zero (unsigned n_layers) |
![]() | Zero_Sum_Delta (unsigned n_layers, matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | Build_Sum_Delta (matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | Delete_Sum_Delta (matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | Copy_Sum_Delta_To_Delta (unsigned n_layers, LayerNetTrain layer[], matrix* Sum_Delta_W[], vect* Sum_delta_bias[]) |
![]() | computeclassWTA (vect& out) |
![]() | computeclass (vect& out) |
Simple perceptron
It Implements a simple perceptron for classification with learning capabilities
Alphabetic index HTML hierarchy of classes or Java