Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

keras conv2d batchnorm

# import BatchNormalization
from keras.layers.normalization import BatchNormalization

# instantiate model
model = Sequential()

# we can think of this chunk as the input layer
model.add(Dense(64, input_dim=14, init='uniform'))
model.add(BatchNormalization())
model.add(Activation('tanh'))
model.add(Dropout(0.5))

# we can think of this chunk as the hidden layer    
model.add(Dense(64, init='uniform'))
model.add(BatchNormalization())
model.add(Activation('tanh'))
model.add(Dropout(0.5))

# we can think of this chunk as the output layer
model.add(Dense(2, init='uniform'))
model.add(BatchNormalization())
model.add(Activation('softmax'))

# setting up the optimization of our weights 
sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='binary_crossentropy', optimizer=sgd)

# running the fitting
model.fit(X_train, y_train, nb_epoch=20, batch_size=16, show_accuracy=True, validation_split=0.2, verbose = 2)
Comment

PREVIOUS NEXT
Code Example
Python :: readlines replace  
Python :: how to show a progress spinner when python script is running 
Python :: Python Selenium import WebElement 
Python :: django oauth toolkit permanent access token 
Python :: adding number in set in python 
Python :: python string cut left 
Python :: length of list python 
Python :: selenium webdriver options python 
Python :: Python "for in" loop to print the last item in the list 
Python :: beautifulsoup find element by partial text 
Python :: split string into groups of 3 chars python 
Python :: how to get first element of array in python 
Python :: docker mount volume 
Python :: scikit learn roc curve 
Python :: remove na python 
Python :: aws django migrate 
Python :: python lists tuples sets dictionaries 
Python :: accessing items of tuple in python 
Python :: python reference parent module 
Python :: df add value at first index 
Python :: how to add python interpreter in vscode 
Python :: how to reference variable in another file python 
Python :: multiple arguments with multiprocessing python 
Python :: floating point python 
Python :: sys.maxsize in python 
Python :: how to username in python? 
Python :: smtp python set subject 
Python :: python spliting string into list 
Python :: pytorch version python command 
Python :: pip install opencv 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =