Keras

Install

under the hood uses Tensorflow/Theano

Pre-trained model with Keras

supports cloud

Theano

TensorFlow

GPU

GPU

Distributed computing

just by updating config change from Tensorflow to Theano

Tensorflow

low level

For research suitable

Keras

High level

only can use built-in layers

fast experimentation

fast prototype

also works in production

click to edit

Supervised NN

Keras Flow

create model object

compile model(here Keras generae tensorflow/theano model)

train model (fir function)

testing (evaluate function)

save the model (model.save)

to evaluate (first load saved model then model.predict function)

Models

sequencial

click to edit

layer added in sequence

Layers

Dense

Convolution

RNN

Pandas

used for data loading

pre-procesing

scale data (between 0-1)

sklearn for preprocessing

sklearn.preprocessing.MinMaxScaler().fit_transform() if used first time only so that sklearn figureout the scaling. for second time (test data) we use transform() function
. scaler gives plain array so we need to create a pandas frame objects

Fit()

epochs,shuffle,verbos=2,

evaluate

loss fucntione defined in compile time will be used to calcutae the error

predict

predict will take input and produce the output in 2D array so use [0][0] if only one input you are predicting. You also need to scal the output back.

pre-trained models

ResNet50 (models.applications)

VGG

inception

Xception

Tensorboard with Keras

after compiling model,create logger (keras.callback.tensorboard)

log_dir,write_graph,histrogram_freq=5(means every 5 back prop the performance is noted)

histogram in tensorflow is to know how each layer is performing

in fit() function add callback parameters

Visualising

run command tensorboard --logdir=

same color boxes of layers mean same internal structure

trace input button on tensorboard for tracing path of input

if you want to compare multiple designs of NN, log the inputs for tensorboard in same folder and while starting tensorboard give input as root log folder.

export Tensorflow model

we can export keras model in Tensorflow