ANNs with Keras API Algorithms in Bioinformatics Ph
ANNs with Keras API Algorithms in Bioinformatics
Ph. D student with Morten Who am I? Graduated in March Warning! I am no expert
What’s up for today? Play with Keras API Why is Keras smart? Other frameworks?
How to build an Artificial Neural Network? • Invariant parameters • Input dimension • Output dimension • Semi-variable • Loss-function • Variable • # hidden layers • # hidden neurons • Activation functions • GD optimizations • Add-ons • Normalization • Regularization • Dropout
How do I build the best network? You most likely won’t
Load Data. Define Model. Getting started Compile Model. Fit Model. Evaluate Model.
Load data • Peptides in amino acid sequence • Encode AA using BLOSUM : independend variable (X) • Binding affinity : dependend variable (y) • We will take a look at it later
Define model from keras. models import Sequential from keras. layers import Dense import numpy as np # fix random seed for reproducibility np. random. seed(7) # create model = Sequential() model. add(Dense(12, input_dim=INPUT_DIMENSIONS, activation='relu')) model. add(Dense(8, activation='relu')) model. add(Dense(1, activation='sigmoid'))
Compile model # Compile model. compile(loss='binary_crossentropy’, optimizer='adam', metrics=['accuracy'])
Fit Model # Fit the model. fit(X, Y, epochs=EPOCHS, batch_size=BATCH_SIZE, validation_data=(X_val, y_val))
Evaluate model # evaluate the model scores = model. evaluate(X, Y) print("n%s: %. 2 f%%" % (model. metrics_names[1], scores[1]*100))
Avoid overfitting • Regularization from keras. regularizers import l 2 model. add(Dense(number_of_neurons, activation = 'relu’, kernel_regularizer=l 2(0. 001))) • Dropout from keras. layers import Dropout model. add(Dropout(0. 2)) • Batch normalization from keras. layers. normalization import Batch. Normalization model. add(Batch. Normalization())
Give it a go! Exercise can be found on padawan in /home/people/herpov/algorithms_in_bioinformatics/ Contains a notebook, the relevant data, and exercise instructions
- Slides: 13