Question

I need a deep learning a code tutorial in Matlab or Python with explanation. I prefer if its matrices related.

I need a deep learning a code tutorial in Matlab or Python with explanation. I prefer if its matrices related.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

To install keras on your machine using PIP, run the following command.

sudo pip install keras

Steps to implement your deep learning program in Keras

  1. Load Data.
  2. Define Model.
  3. Compile Model.
  4. Fit Model.
  5. Evaluate Model.
  6. Tie It All Together.

Program :

# Importing Keras Sequential Model
from keras.models import Sequential
from keras.layers import Dense
import numpy

# Initializing the seed value to a integer.
seed = 7

numpy.random.seed(seed)

# Loading the data set (PIMA Diabetes Dataset)
dataset = numpy.loadtxt('datasets/pima-indians-diabetes.csv', delimiter=",")

# Loading the input values to X and Label values Y using slicing.
X = dataset[:, 0:8]
Y = dataset[:, 8]

# Initializing the Sequential model from KERAS.
model = Sequential()

# Creating a 16 neuron hidden layer with Linear Rectified activation function.
model.add(Dense(16, input_dim=8, init='uniform', activation='relu'))

# Creating a 8 neuron hidden layer.
model.add(Dense(8, init='uniform', activation='relu'))

# Adding a output layer.
model.add(Dense(1, init='uniform', activation='sigmoid'))

# Compiling the model
model.compile(loss='binary_crossentropy',
              optimizer='adam', metrics=['accuracy'])
# Fitting the model
model.fit(X, Y, nb_epoch=150, batch_size=10)

scores = model.evaluate(X, Y)

print("%s: %.2f%%" % (model.metrics_names[1], scores[1] * 100))

Add a comment
Know the answer?
Add Answer to:
I need a deep learning a code tutorial in Matlab or Python with explanation. I prefer if its matrices related.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT