//input is a picture's matrix public Network(int inputs_count, int input_w, int input_h, int mpl1_neurons_number, int mpl2_neurons_number, int result_vector_lenght) { mpl_first = new MPL_Layer(inputs_count, input_w, input_h, mpl1_neurons_number, mpl2_neurons_number); mpl_second = new MPL_Layer(mpl_first, mpl2_neurons_number, result_vector_lenght); output = new OutPutLayer(mpl_second, result_vector_lenght); this.result_vector_lenght = result_vector_lenght; }
public OutPutLayer(MPL_Layer mpl, int outp_number) { this.input = mpl.output; this.inputs_number = mpl.outputs_number; this.outputs_number = outp_number; this.weights = new float[inputs_number, outputs_number]; MatrixOperations.init_matrix_random(weights, inputs_number, outputs_number); non_activated_stages = new float[outputs_number]; error = new float[outputs_number]; output = new float[outputs_number]; }
public MPL_Layer(MPL_Layer prev_mpl, int neurons_number, int next_layer_neurons_number) { //total number of previous layer's neurons this.full_inputs_number = prev_mpl.outputs_number; //full-connected layer this.full_input = prev_mpl.output; this.outputs_number = neurons_number; // this.bj_prev = prev_subsampling.bj; this.next_layer_outputs_number = next_layer_neurons_number; this.output = new float[outputs_number]; this.non_activated_stages = new float[outputs_number]; this.errors = new float[outputs_number]; this.weights = new float[full_inputs_number, outputs_number]; // MatrixOperations.init_matrix_random(weights, full_inputs_number, outputs_number); }