Example #1
0
	def modeling(self, l = [2121, 100, 50, 10, 1]):
		"""
		Generate a model with the give number of layers.
		Previously, always a 5 layer model is generated. 
		Now it is changed to make adaptive number of layers. 
		If l = [2121, 1], it is linear regressoin method. 

		- l2_param is a self parameter rather than an input parameter.
		"""
		l2_param = self.l2_param

		model = Sequential()
		model.add(Dense( l[1], input_shape=(l[0],)))
		model.regularizers = [l2(l2_param)]

		for n_w_l in l[2:]:
			model.add(Activation('relu'))
			#model.add(Dropout(0.4))
			# model.add(Dense( n_w_l, W_regularizer = l2(.01)))
			model.add(Dense( n_w_l))
	 
		return model