The the mapper of restricted Boltzmann machine (RBM) training part in deep learning MapReduce program

/*
 * Project Name: Deep learning based on Hadoop (MapReduce)
 * 
 * Class Description: 
 * 	This is the mapper of restricted Boltzmann machine (RBM) training part in deep learning MapReduce program.
 *  The task of this MapReduce is to train the rbm between two layers in unsupervised way,
 *  and output the updated weight.
 *  
 *  Each mapper only trains the weights for one iteration using one test case. 
 *  So, in order to train the weights of the whole neural network, the MapReduce program needs to execute (maxEpoch * layerNum) times.
 * 
 * Class Structure: 
 * 	It contains four parts: 
 * 		configure() reads all the configurations and distributed cache from outside. 
 * 		initialize() parse the input strings into parameters, and initialize parameters for algorithm.
 * 		getposphase() does the positive phase of RBM training
 *   	getnegphase() does the negative phase of RBM training
 *   	update() computes the update of weights using previous results and parameters
 * 		map() implements the mapper. It outputs the original key and updated value pair.
 * 
 * Algorithm Description:
 * 	This program trains Restricted Boltzmann Machine in which
 * 	visible, binary, stochastic pixels are connected to hidden, binary, stochastic 
 * 	feature detectors using symmetrically weighted connections. Learning is done with 1-step 
 * 	Contrastive Divergence. The program assumes that the following variables are set externally:
 *		maxepoch  -- maximum number of epochs
 *		numhid    -- number of hidden units 
 * 		batchdata -- the data that is divided into batches (numcases numdims numbatches)
 * 		restart   -- set to 1 if learning starts from beginning 
 * 
 * Author: Gengtao Jia (Single-node version) and Kairan Sun (Debugging and MapReduce version)
 * Last Update Date: Nov. 30, 2013 
 */