|
MiniDNN
|
#include <Network.h>
Public Member Functions | |
| Network () | |
| Network (RNG &rng) | |
| ~Network () | |
| void | add_layer (Layer *layer) |
| void | set_output (Output *output) |
| int | num_layers () const |
| std::vector< const Layer * > | get_layers () const |
| const Output * | get_output () const |
| void | set_callback (Callback &callback) |
| void | set_default_callback () |
| void | init (const Scalar &mu=Scalar(0), const Scalar &sigma=Scalar(0.01), int seed=-1) |
| std::vector< std::vector< Scalar > > | get_parameters () const |
| void | set_parameters (const std::vector< std::vector< Scalar > > ¶m) |
| std::vector< std::vector< Scalar > > | get_derivatives () const |
| template<typename TargetType > | |
| void | check_gradient (const Matrix &input, const TargetType &target, int npoints, int seed=-1) |
| template<typename DerivedX , typename DerivedY > | |
| bool | fit (Optimizer &opt, const Eigen::MatrixBase< DerivedX > &x, const Eigen::MatrixBase< DerivedY > &y, int batch_size, int epoch, int seed=-1) |
| Matrix | predict (const Matrix &x) |
This class represents a neural network model that typically consists of a number of hidden layers and an output layer. It provides functions for network building, model fitting, and prediction, etc.
|
inline |
|
inline |
|
inline |
|
inline |
Add a hidden layer to the neural network
| layer | A pointer to a Layer object, typically constructed from layer classes such as FullyConnected and Convolutional. NOTE: the pointer will be handled and freed by the network object, so do not delete it manually. |
|
inline |
Set the output layer of the neural network
| output | A pointer to an Output object, typically constructed from output layer classes such as RegressionMSE and MultiClassEntropy. NOTE: the pointer will be handled and freed by the network object, so do not delete it manually. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Fit the model based on the given data
| opt | An object that inherits from the Optimizer class, indicating the optimization algorithm to use. |
| x | The predictors. Each column is an observation. |
| y | The response variable. Each column is an observation. |
| batch_size | Mini-batch size. |
| epoch | Number of epochs of training. |
| seed | Set the random seed of the RNG if seed > 0, otherwise use the current random state. |
|
inline |