|
A singular Riemannian geometry approach to Deep Neural Networks.
|
#include <neural_network.h>
Public Member Functions | |
| neural_network () | |
| neural_network (const std::vector< layer * > &ls) | |
| ~neural_network () | |
| int | get_num_layers () |
| void | print_network_info () |
| void | print_network_detailed_info () |
| Eigen::VectorXd | predict (const Eigen::VectorXd &input) |
| Eigen::VectorXd | predict_to_layer (int tolayer, const Eigen::VectorXd &input) |
| std::vector< Eigen::VectorXd > | predict (const std::vector< Eigen::VectorXd > &input) |
| std::vector< Eigen::VectorXd > | predict_to_layer (int tolayer, const std::vector< Eigen::VectorXd > &input) |
| void | network_read (const std::string &filename) |
| void | network_save (const std::string &filename) |
| void | add_layer_all_parameters (int wrows, int wcols, int in_dim, int out_dim, std::string type) |
| void | add_fc_input_layer (int in_dim, int out_dim, std::string type) |
| void | add_fc_hidden_layer (int out_dim, std::string type) |
| void | set_layer_weights (int num_layer, Eigen::MatrixXd &weights_) |
| void | set_layer_biases (int num_layer, Eigen::VectorXd &biases_) |
| Eigen::MatrixXd | get_layer_weights (int num_layer) |
| Eigen::VectorXd | get_layer_biases (int num_layer) |
| double | loss_mse (const std::vector< Eigen::VectorXd > &data, const std::vector< Eigen::VectorXd > &features) |
| double | accuracy (const std::vector< Eigen::VectorXd > &data, const std::vector< Eigen::VectorXd > &features) |
| void | SiMEC_1D (std::string output_file, int steps, double delta, bool invert_build, Eigen::VectorXd ipoint) |
| void | SiMEC_1D_norm_proj (std::string output_file, int steps, double delta, bool invert_build, Eigen::VectorXd ipoint, Eigen::VectorXd &H_inf, Eigen::VectorXd &H_sup) |
| void | SiMEC_1D_stop_boundary (std::string output_file, int steps, double delta, bool invert_build, Eigen::VectorXd ipoint, Eigen::VectorXd &H_inf, Eigen::VectorXd &H_sup) |
| void | SiMExp_1D (std::string output_file, double delta, double epsilon, int max_steps, bool invert_build, Eigen::VectorXd &ipoint) |
| void | ClassChange_1D (std::string output_file, int steps, double delta, bool invert_build, Eigen::VectorXd ipoint) |
| layer * | get_layer (int n) |
Neural network class.
|
inline |
Default constructor.
| neural_network::neural_network | ( | const std::vector< layer * > & | ls | ) |
Builds a neural network given a vectors of pointers to layers.
|
inline |
Default deconstructor
| void neural_network::add_fc_hidden_layer | ( | int | out_dim, |
| std::string | type | ||
| ) |
Adds an hidden layer of a fully-connected feedforward layer to the neural network. Arguments:
Note: The last hidden layer built invoking this method is the final layer of the network.
| void neural_network::add_fc_input_layer | ( | int | in_dim, |
| int | out_dim, | ||
| std::string | type | ||
| ) |
Builds the input layer of a fully-connected feedforward layer to the neural network. Arguments:
| void neural_network::add_layer_all_parameters | ( | int | wrows, |
| int | wcols, | ||
| int | in_dim, | ||
| int | out_dim, | ||
| std::string | type | ||
| ) |
Append a layer to the neural network. Arguments:
Note: For feedforward layers wrows = in_dim and wcols = out_dim.
| void neural_network::ClassChange_1D | ( | std::string | output_file, |
| int | steps, | ||
| double | delta, | ||
| bool | invert_build, | ||
| Eigen::VectorXd | ipoint | ||
| ) |
Starting from a point, proceed along the curve which change the output of the network the most. Instead of this method, use SiMExp_1D, which avoids infinite loop by coinstruction.
| Eigen::VectorXd neural_network::get_layer_biases | ( | int | num_layer | ) |
Returns a copy of the biases vector of a given layer.
| Eigen::MatrixXd neural_network::get_layer_weights | ( | int | num_layer | ) |
Returns a copy of the weights matrix of a given layer.
| int neural_network::get_num_layers | ( | ) |
Returns the number of layers of the neural network.
| void neural_network::network_read | ( | const std::string & | filename | ) |
Reads network from file
| void neural_network::network_save | ( | const std::string & | filename | ) |
Saves network to file
| Eigen::VectorXd neural_network::predict | ( | const Eigen::VectorXd & | input | ) |
Computes the output of the neural network for a given input.
| std::vector< Eigen::VectorXd > neural_network::predict | ( | const std::vector< Eigen::VectorXd > & | input | ) |
Computes the outputs of the neural network for a given vector of inputs.
| Eigen::VectorXd neural_network::predict_to_layer | ( | int | tolayer, |
| const Eigen::VectorXd & | input | ||
| ) |
Computes the output of the subnetwork up to a specified layer for a given input.
| std::vector< Eigen::VectorXd > neural_network::predict_to_layer | ( | int | tolayer, |
| const std::vector< Eigen::VectorXd > & | input | ||
| ) |
Computes the outputs of the subnetwork up to a specified layer for a given vector of inputs.
| void neural_network::print_network_detailed_info | ( | ) |
Prints detailed info about the neural network.
| void neural_network::print_network_info | ( | ) |
Prints info about the neural network.
| void neural_network::set_layer_biases | ( | int | num_layer, |
| Eigen::VectorXd & | biases_ | ||
| ) |
Sets the biases of a given layer given a vector in input.
| void neural_network::set_layer_weights | ( | int | num_layer, |
| Eigen::MatrixXd & | weights_ | ||
| ) |
Sets the weights of a given layer given a matrix in input.
| void neural_network::SiMEC_1D | ( | std::string | output_file, |
| int | steps, | ||
| double | delta, | ||
| bool | invert_build, | ||
| Eigen::VectorXd | ipoint | ||
| ) |
Basic version of the SiMEC_1D algorithm, bulding the equaivalence class of a point.
Arguments:
| void neural_network::SiMEC_1D_norm_proj | ( | std::string | output_file, |
| int | steps, | ||
| double | delta, | ||
| bool | invert_build, | ||
| Eigen::VectorXd | ipoint, | ||
| Eigen::VectorXd & | H_inf, | ||
| Eigen::VectorXd & | H_sup | ||
| ) |
A modification of the SiMEC_1D algorithm. When it hits the boundary it projects inside the hypercube \((a_1\cdots,a_n) \times (b_1,\cdots,b_n) \).
Arguments:
| void neural_network::SiMEC_1D_stop_boundary | ( | std::string | output_file, |
| int | steps, | ||
| double | delta, | ||
| bool | invert_build, | ||
| Eigen::VectorXd | ipoint, | ||
| Eigen::VectorXd & | H_inf, | ||
| Eigen::VectorXd & | H_sup | ||
| ) |
A modification of the SiMEC_1D algorithm. Hitting the boundary of the hypercube \((a_1\cdots,a_n) \times (b_1,\cdots,b_n) \) halts the algorithm.
Arguments:
| void neural_network::SiMExp_1D | ( | std::string | output_file, |
| double | delta, | ||
| double | epsilon, | ||
| int | max_steps, | ||
| bool | invert_build, | ||
| Eigen::VectorXd & | ipoint | ||
| ) |
SiMExp_1D algorithm. Produces a non-null curve of maximum lenght epsilon starting from a given point.
Arguments:
1.8.17