30 arma::Mat<DNN_Dtype>
T;
31 arma::Mat<DNN_Dtype>
T1;
80 virtual arma::Mat<DNN_Dtype>
get_T_1(
void)
88 virtual void set_data(
const arma::Mat<DNN_Dtype>* data)
91 data_len = data->n_cols;
112 T1 = data_labels->col(data_ix);
114 if(data_ix >= data_len)
129 for (arma::uword k=0 ; k<
N_batch ; k++ )
131 T.col(k) = data_labels->col(data_ix++);
132 if(data_ix >= data_len)
138 T = data_labels->cols(data_ix,data_ix+
N_batch-1);
155 for(arma::uword n=0; n<
N_batch; n++)
157 arma::uword A=
Y.col(n).index_max();
158 arma::uword
B=T.col(n).index_max();
220 std::cout <<
"Loss function: MSE" << std::endl;
234 id =
type+
" MSE sigm";
264 for (arma::uword k=0 ; k<
N_batch ; k++ )
305 std::cout <<
"Loss function: MSE" << std::endl;
320 id =
type+
" CE cost";
349 for (arma::uword k=0 ; k<
N_batch ; k++ )
390 std::cout <<
"Loss function: CE with softmax activation" << std::endl;
404 id =
type+
" CE sigm";
434 for (arma::uword k=0 ; k<
N_batch ; k++ )
467 for (arma::uword c=0 ; c<
T.n_cols ; c++ )
469 for (arma::uword r=0 ; r<
T.n_rows ; r++ )
472 cost+= -arma::trunc_log(
Y.at(r,c));
474 cost+= -arma::trunc_log(1-
Y.at(r,c));
487 std::cout <<
"Loss function: CE with sigmoid activation" << std::endl;
502 id =
type+
" CE softmax";
531 for (arma::uword k=0 ; k<
N_batch ; k++ )
572 std::cout <<
"Loss function: CE with softmax activation" << std::endl;
virtual void prop_mb(void)
Forward mini batch propagation though layer.
virtual void disp(void)
Display info about layer.
void disp(void)
Display info about layer.
std::string type
Layer type string.
arma::Mat< DNN_Dtype > Y
Output buffer mini batch [N_right,N_batch].
Cross Entropy cost/output layer class with sigmoid activation.
void backprop(void)
Backpropagation of mini batch propagation though layer.
virtual void set_data(const arma::Mat< DNN_Dtype > *data)
Set new target/label data.
virtual arma::Mat< DNN_Dtype > get_T_1(void)
Get target buffer.
virtual void init(void)
Initialization of layer.
Cross Entropy cost/output layer class with softmax activation.
arma::uword N_channels_right
Output channels, number of filters.
void prop_mb(void)
Forward mini batch propagation though layer.
void prop_mb(void)
Forward mini batch propagation though layer.
arma::Mat< DNN_Dtype > Dleft
Error buffer [N_left,N_batch].
Cost/output layer base class.
arma::Mat< DNN_Dtype > Y1
Output buffer [N_right,1].
void backprop(void)
Backpropagation of mini batch propagation though layer.
arma::Mat< DNN_Dtype > T1
virtual arma::uword get_nrof_outputs(void)
Get total number of layer outputs.
Mean Square Error cost/output layer class.
virtual arma::Mat< DNN_Dtype > get_Y1(void)
Get output buffer.
virtual void init(void)
Initialize layer.
DNN_Dtype get_cost(void)
Get cost.
arma::Mat< DNN_Dtype > B
Bias.
void backprop(void)
Backpropagation of mini batch propagation though layer.
void disp(void)
Display info about layer.
virtual arma::uword get_nrof_channels(void)
Get output buffer channel/layer size.
void disp(void)
Display info about layer.
void prop_mb(void)
Forward mini batch propagation though layer.
DNN_Dtype sigmoid(const DNN_Dtype x)
Sigmoid function - scalar.
virtual DNN_Dtype get_acc(void)
Get accuracy.
cost_MSE(void)
MSE cost layer constructor.
virtual void disp(void)
Display info about layer.
float DNN_Dtype
Data type used in the network (float or double)
void prop(void)
Forward propagation though layer.
arma::uword N_left
Total size left.
arma::uword N_rows_right
Output rows.
void backprop(void)
Backpropagation of mini batch propagation though layer.
void backprop(void)
Backpropagation of mini batch propagation though layer.
const arma::Mat< DNN_Dtype > * data_labels
virtual void prop(void)
Forward propagation though layer.
void prop(void)
Forward propagation though layer.
DNN_Dtype get_cost(void)
Get cost.
void prop(void)
Forward propagation though layer.
DNN_Dtype get_cost(void)
Get cost.
virtual arma::uword get_nrof_cols(void)
Get output buffer column size.
void disp(void)
Display info about layer.
arma::uword N_batch
Mini batch size.
void prop(void)
Forward propagation though layer.
Mean Square Error cost/output layer class with sigmoid activation.
layer_cost(void)
Dense layer constructor.
DNN_Dtype get_cost(void)
Get cost.
virtual void upd_buf_size(arma::uword nmb)
Updates the buffer sizes.
DNN_Dtype get_cost(void)
Get cost.
virtual void backprop(void)=0
Back propagation.
virtual arma::uword get_nrof_rows(void)
Get output buffer row size.
void prop_mb(void)
Forward mini batch propagation though layer.
arma::uword N_right
Total size right.
void disp(void)
Display info about layer.
layer * left
Pointer to previous layer.
arma::uword N_cols_right
Output cols.
virtual arma::Mat< DNN_Dtype > * get_Y_ptr(void)
Get output buffer pointer - mini batch.
arma::Mat< DNN_Dtype > softmax(const arma::Mat< DNN_Dtype > &x)
Softmax function - matrix.
Cross Entropy cost/output layer class with linear activation.
virtual DNN_Dtype get_cost(void)=0
virtual void reset_batch_ctr(void)
Reset batch counter.