How to neural networks classification python (Python Programing Language)

Asked by: Livio McCowan
Edit Question Icon
Edit
Follow Icon
Report Icon
Report

Explain Below What Do You Want to report!


Available Answers: 1

Taher Vijaykar (CONCRETE PAVING MACHINE OPERATOR Counseling, Qa, Cfa) From: Kanpur/India
1
# first neural network with keras tutorial
2
from numpy import loadtxt
3
from keras.models import Sequential
4
from keras.layers import Dense
5
# load the dataset
6
dataset = loadtxt('pima-indians-diabetes.csv', delimiter=',')
7
# split into input (X) and output (y) variables
8
X = dataset[:,0:8]
9
y = dataset[:,8]
10
# define the keras model
11
model = Sequential()
12
model.add(Dense(12, input_dim=8, activation='relu'))
13
model.add(Dense(8, activation='relu'))
14
model.add(Dense(1, activation='sigmoid'))
15
# compile the keras model
16
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
17
# fit the keras model on the dataset
18
model.fit(X, y, epochs=150, batch_size=10)
19
# evaluate the keras model
20
_, accuracy = model.evaluate(X, y)
21
print('Accuracy: %.2f' % (accuracy*100))
22
‚Äč
Upvote Icon4
Comment IconComment
Follow Icon
Report IconReport

Explain Below What Do You Want to report!


Explain Below What Do You Want to comment!




More Questions


Would you like to join Ask Sawal!

Why?

  1. Ask Sawal is a fast growing question and answer discussion forum.

  2. 15 lakh+ questions were answered by our Ask Sawal Members.

  3. Each day 1000s of questions asked & 1000s of questions answered.

  4. Ask any question and get answer from 2.5 Lakh+ Ask Sawal Members.

  5. Constant moderation and reporting option makes questions and answers spam free.

  6. And also, we have free blogging platform. Write an article on any topic.

  7. We have 10000+ visitors each day. So a beneficial platform for link building.

  8. We are allowing link sharing. Create backlinks to your blog site or any site.

  9. Gain extra passive income by sharing your affiliate links in articles and answers.