(self,inputs,targets,niterations=100)
Train the thing
Train the thing
Train the thing
def mlptrain(self,inputs,targets,niterations=100):
        """ Train the thing """    
        # Add the inputs that match the bias node
        inputs = np.concatenate((inputs,-np.ones((self.ndata,1))),axis=1)

	# Put all the weights into a single row vector
	w = np.concatenate((self.weights1.flatten(),self.weights2.flatten()))

	#out = so.fmin_cg(self.mlperror, w, fprime=None, args=(inputs,targets), gtol=1e-05, maxiter=5000, full_output=True, disp=1)
	out = so.fmin_cg(self.mlperror, w, fprime=self.mlpgrad, args=(inputs,targets), gtol=1e-05, maxiter=10000, full_output=True, disp=1)

	wopt = out[0]

	# Put the updated weights back into the matrices
	split = (self.nin+1)*self.nhidden
	self.weights1 = np.reshape(wopt[:split],(self.nin+1,self.nhidden))
	self.weights2 = np.reshape(wopt[split:],(self.nhidden+1,self.nout))
def mlptrain ( self , inputs , targets , niterations = 100 ) : # Add the inputs that match the bias node inputs = np . concatenate ( ( inputs , - np . ones ( ( self . ndata , 1 ) ) ) , axis = 1 ) # Put all the weights into a single row vector w = np . concatenate ( ( self . weights1 . flatten ( ) , self . weights2 . flatten ( ) ) ) #out = so.fmin_cg(self.mlperror, w, fprime=None, args=(inputs,targets), gtol=1e-05, maxiter=5000, full_output=True, disp=1) out = so . fmin_cg ( self . mlperror , w , fprime = self . mlpgrad , args = ( inputs , targets ) , gtol = 1e-05 , maxiter = 10000 , full_output = True , disp = 1 ) wopt = out [ 0 ] # Put the updated weights back into the matrices split = ( self . nin + 1 ) * self . nhidden self . weights1 = np . reshape ( wopt [ : split ] , ( self . nin + 1 , self . nhidden ) ) self . weights2 = np . reshape ( wopt [ split : ] , ( self . nhidden + 1 , self . nout ) )