SlideShare a Scribd company logo
RAMCO INSTITUTE OF TECHNOLOGY
RAJAPALAYAM
13.04.2020
Prepared by Dr.M.Kaliappan, Associate Professor/CSE
--------------------------------------------------------------------------------------------------------------------
Topic: Implementation of Regression with Neural Networks using TensorFlow in Amazon
Deep Learning Server
---------------------------------------------------------------------------------------------------------------------
1. Visit to https://aws.amazon.com/deep-learning/
2. Sign in to console , if not, signup with your data and make payment of Rs.2/-
3. Click on services  then, click on EC2
4. Click on EC2 Dashboard and launch instances
5. Press Ctrl+F (search) : Search a keyword deep learning
6. Select Deep learning AMI(Amazon Linux2)
7. Choose an instance type
8. Click Review and launch
9. Click launch
10. Select create a new keypair
11. Give key file name: key(any name)
12. Download key pair
A key.pem file is downloaded and saved in your computer(Download section)
13. Select your created instances
14. Click connect button
Copy the Public DNS: ec2-3-133-153-1.us-east-2.compute.amazonaws.com
15. Open command prompt  go to Downloads
Type the following command
ssh -L localhost:8888:localhost:8888 -i key1.pem ec2-user@ec2-3-133-153-1.us-east-
2.compute.amazonaws.com
Now, we got Amazon Linux system
16. Type jupyter notebook
The jupyter notebook is running at the following URL.
17. Type this URL in browser.
Click on new button. Select Environment (conda_tensorflow_p36)
Regression with Neural Networks using TensorFlow Keras API
(Blue color represents code, copy and paste in jupyter notebook)
Figure 1: Neural Network
In regression, the computer/machine should be able to predict a value – mostly numeric.
Generate Data: Here we are going to generate some data using our own function. This function
is a non-linear function and a usual line fitting may not work for such a function
def myfunc(x):
if x < 30:
mult = 10
elif x < 60:
mult = 20
else:
mult = 50
return x*mult
Let us check what does this function return.
print(myfunc(10))
print(myfunc(30))
print(myfunc(60))
It should print something like:
100
600
3000
Now, let us generate data. Let us import numpy library as np. here x is a numpy array of input
values. Then, we are generating values between 0 and 100 with a gap of 0.01 using arange
function. It generates a numpy array.
import numpy as np
x = np.arange(0, 100, .01)
print(x)
data:
array([0.000e+00, 1.000e-02, 2.000e-02, ..., 9.997e+01, 9.998e+01, 9.999e+01])
To call a function repeatedly on a numpy array we first need to convert the function using
vectorize. Afterwards, we are converting 1-D array to 2-D array having only one value in the
second dimension – you can think of it as a table of data with only one column.
myfuncv = np.vectorize(myfunc)
y = myfuncv(x)
X = x.reshape(-1, 1)
Print(X)
[[0.000e+00],
[1.000e-02],
[2.000e-02],
...
[9.997e+01],
[9.998e+01],
[9.999e+01]]
Now, we have X representing the input data with single feature and y representing the output.
We will now split this data into two parts: training set (X_train, y_train) and test set (X_test
y_test). We are going make neural ne
to produce y from X – we are going to test the model on the test set.
import sklearn.model_selection as sk
X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state
Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You
can try plotting X vs y, as well as, X_test vs y_test.
import matplotlib.pyplot as plt
plt.scatter(X_train,y_train)
plt.scatter(X_test,y_test)
Now, we have X representing the input data with single feature and y representing the output.
We will now split this data into two parts: training set (X_train, y_train) and test set (X_test
y_test). We are going make neural network learn from training data, and once it has learnt
we are going to test the model on the test set.
import sklearn.model_selection as sk
X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state
Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You
can try plotting X vs y, as well as, X_test vs y_test.
Figure 2: X_train vs y_train
Now, we have X representing the input data with single feature and y representing the output.
We will now split this data into two parts: training set (X_train, y_train) and test set (X_test
twork learn from training data, and once it has learnt – how
X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state = 42)
Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You
Let us import TensorFlow libraries and check the version.
import tensorflow as tf
print(tf.__version__)
Now, let us create a neural network using Keras API of TensorFlow.
# Import the kera modules
from keras.layers import Input, Dense
from keras.models import Model
# This returns a tensor. Since the input only has one column
inputs = Input(shape=(1,))
# a layer instance is callable on a tensor, and returns a tensor
# To the first layer we are feeding inputs
x = Dense(32, activation='relu')(inputs)
# To the next layer we are feeding the result of previous call here it is h
x = Dense(64, activation='relu')(x)
x = Dense(64, activation='relu')(x)
# Predictions are the result of the neural network. Notice that the predictions are also having one
column.
predictions = Dense(1)(x)
# This creates a model that includes
# the Input layer and three Dense layers
model = Model(inputs=inputs, outputs=predictions)
# Here the loss function is mse -
model.compile(optimizer='rmsprop',
loss='mse',
Figure 2: X_test vs y_test
et us import TensorFlow libraries and check the version.
us create a neural network using Keras API of TensorFlow.
from keras.layers import Input, Dense
from keras.models import Model
# This returns a tensor. Since the input only has one column
# a layer instance is callable on a tensor, and returns a tensor
# To the first layer we are feeding inputs
x = Dense(32, activation='relu')(inputs)
# To the next layer we are feeding the result of previous call here it is h
)(x)
x = Dense(64, activation='relu')(x)
# Predictions are the result of the neural network. Notice that the predictions are also having one
# This creates a model that includes
# the Input layer and three Dense layers
odel = Model(inputs=inputs, outputs=predictions)
Mean Squared Error because it is a regression problem.
model.compile(optimizer='rmsprop',
# Predictions are the result of the neural network. Notice that the predictions are also having one
Mean Squared Error because it is a regression problem.
metrics=['mse'])
Let us now train the model. First, it would initialize the weights of each neuron with random
values and the using backpropagation it is going to tweak the weights in order to get the
appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of
X at a time.
model.fit(X_train, y_train, epochs=500, batch_size=100) # starts training
Once we have trained the model. We can do predictions using the predict method of the model.
In our case, this model should predict y using X. Let us test it over our test set. Plot the results.
y_test = model.predict(X_test)
plt.scatter(X_test, y_test)
References:
1. https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n
eural_networks.htm
2. https://cloudxlab.com/blog/regression
. First, it would initialize the weights of each neuron with random
values and the using backpropagation it is going to tweak the weights in order to get the
appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of
model.fit(X_train, y_train, epochs=500, batch_size=100) # starts training
Once we have trained the model. We can do predictions using the predict method of the model.
In our case, this model should predict y using X. Let us test it over our test set. Plot the results.
https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n
https://cloudxlab.com/blog/regression-using-tensorflow-keras-api/
. First, it would initialize the weights of each neuron with random
values and the using backpropagation it is going to tweak the weights in order to get the
appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of
Once we have trained the model. We can do predictions using the predict method of the model.
In our case, this model should predict y using X. Let us test it over our test set. Plot the results.
https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n

More Related Content

What's hot

Keras cheat sheet_python
Keras cheat sheet_pythonKeras cheat sheet_python
Keras cheat sheet_python
Coding Tonic
 
TensorFlow
TensorFlowTensorFlow
TensorFlow
jirimaterna
 
Explanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expertExplanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expert
홍배 김
 
Probabilistic Programming in Scala
Probabilistic Programming in ScalaProbabilistic Programming in Scala
Probabilistic Programming in ScalaBeScala
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to Tensorflow
Khor SoonHin
 
Introduction to Tensorflow
Introduction to TensorflowIntroduction to Tensorflow
Introduction to Tensorflow
Tzar Umang
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow Tutorial
NamHyuk Ahn
 
Cheat Sheet for Machine Learning in Python: Scikit-learn
Cheat Sheet for Machine Learning in Python: Scikit-learnCheat Sheet for Machine Learning in Python: Scikit-learn
Cheat Sheet for Machine Learning in Python: Scikit-learn
Karlijn Willems
 
알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04
HyeonSeok Choi
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in Python
Christoph Matthies
 
Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3
Khor SoonHin
 
Python matplotlib cheat_sheet
Python matplotlib cheat_sheetPython matplotlib cheat_sheet
Python matplotlib cheat_sheet
Nishant Upadhyay
 
Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303
Namgee Lee
 
Build your own Convolutional Neural Network CNN
Build your own Convolutional Neural Network CNNBuild your own Convolutional Neural Network CNN
Build your own Convolutional Neural Network CNN
Hichem Felouat
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
Nishant Upadhyay
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
Hichem Felouat
 
MLHEP 2015: Introductory Lecture #2
MLHEP 2015: Introductory Lecture #2MLHEP 2015: Introductory Lecture #2
MLHEP 2015: Introductory Lecture #2
arogozhnikov
 
07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization
Andres Mendez-Vazquez
 

What's hot (19)

Keras cheat sheet_python
Keras cheat sheet_pythonKeras cheat sheet_python
Keras cheat sheet_python
 
TensorFlow
TensorFlowTensorFlow
TensorFlow
 
Explanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expertExplanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expert
 
Probabilistic Programming in Scala
Probabilistic Programming in ScalaProbabilistic Programming in Scala
Probabilistic Programming in Scala
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to Tensorflow
 
Introduction to Tensorflow
Introduction to TensorflowIntroduction to Tensorflow
Introduction to Tensorflow
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow Tutorial
 
Cheat Sheet for Machine Learning in Python: Scikit-learn
Cheat Sheet for Machine Learning in Python: Scikit-learnCheat Sheet for Machine Learning in Python: Scikit-learn
Cheat Sheet for Machine Learning in Python: Scikit-learn
 
알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04알고리즘 중심의 머신러닝 가이드 Ch04
알고리즘 중심의 머신러닝 가이드 Ch04
 
Lect24 hmm
Lect24 hmmLect24 hmm
Lect24 hmm
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in Python
 
Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3
 
Python matplotlib cheat_sheet
Python matplotlib cheat_sheetPython matplotlib cheat_sheet
Python matplotlib cheat_sheet
 
Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303
 
Build your own Convolutional Neural Network CNN
Build your own Convolutional Neural Network CNNBuild your own Convolutional Neural Network CNN
Build your own Convolutional Neural Network CNN
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
MLHEP 2015: Introductory Lecture #2
MLHEP 2015: Introductory Lecture #2MLHEP 2015: Introductory Lecture #2
MLHEP 2015: Introductory Lecture #2
 
07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization
 

Similar to Neural networks using tensor flow in amazon deep learning server

Naïve Bayes.pptx
Naïve Bayes.pptxNaïve Bayes.pptx
Naïve Bayes.pptx
Dr. Amanpreet Kaur
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
Ganesan Narayanasamy
 
K Means Clustering in ML.pptx
K Means Clustering in ML.pptxK Means Clustering in ML.pptx
K Means Clustering in ML.pptx
Ramakrishna Reddy Bijjam
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
Max Kleiner
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
Max Kleiner
 
Artificial Neural Network for machine learning
Artificial Neural Network for machine learningArtificial Neural Network for machine learning
Artificial Neural Network for machine learning
2303oyxxxjdeepak
 
E10
E10E10
E10
lksoo
 
BPstudy sklearn 20180925
BPstudy sklearn 20180925BPstudy sklearn 20180925
BPstudy sklearn 20180925
Shintaro Fukushima
 
Neural networks
Neural networksNeural networks
Neural networks
HarshitGupta367
 
Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdf
dash41
 
How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make Predictions
Developer Helps
 
APPLIED MACHINE LEARNING
APPLIED MACHINE LEARNINGAPPLIED MACHINE LEARNING
APPLIED MACHINE LEARNING
Revanth Kumar
 
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
NANDHINIS900805
 
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Thomas Fan
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
Chapter3 bp
Chapter3   bpChapter3   bp
Chapter3 bp
kumar tm
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
Debarko De
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
Noor Dhiya
 
# Neural network toolbox
# Neural network toolbox # Neural network toolbox
# Neural network toolbox
VineetKumar508
 

Similar to Neural networks using tensor flow in amazon deep learning server (20)

Naïve Bayes.pptx
Naïve Bayes.pptxNaïve Bayes.pptx
Naïve Bayes.pptx
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
 
K Means Clustering in ML.pptx
K Means Clustering in ML.pptxK Means Clustering in ML.pptx
K Means Clustering in ML.pptx
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
 
Artificial Neural Network for machine learning
Artificial Neural Network for machine learningArtificial Neural Network for machine learning
Artificial Neural Network for machine learning
 
E10
E10E10
E10
 
BPstudy sklearn 20180925
BPstudy sklearn 20180925BPstudy sklearn 20180925
BPstudy sklearn 20180925
 
Neural networks
Neural networksNeural networks
Neural networks
 
Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdf
 
How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make Predictions
 
APPLIED MACHINE LEARNING
APPLIED MACHINE LEARNINGAPPLIED MACHINE LEARNING
APPLIED MACHINE LEARNING
 
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
 
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
RNN.pdf
RNN.pdfRNN.pdf
RNN.pdf
 
Chapter3 bp
Chapter3   bpChapter3   bp
Chapter3 bp
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
 
# Neural network toolbox
# Neural network toolbox # Neural network toolbox
# Neural network toolbox
 

More from Ramco Institute of Technology, Rajapalayam, Tamilnadu, India

AD3251-Data Structures Design-Notes-Tree.pdf
AD3251-Data Structures  Design-Notes-Tree.pdfAD3251-Data Structures  Design-Notes-Tree.pdf
AD3251-Data Structures Design-Notes-Tree.pdf
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures  Design-Notes-Searching-Hashing.pdfAD3251-Data Structures  Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
ASP.NET-stored procedure-manual
ASP.NET-stored procedure-manualASP.NET-stored procedure-manual
Mobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and ApplicationsMobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and Applications
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
CS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and AnswerCS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and Answer
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Unit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systemsUnit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systems
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Virtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc NetworksVirtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc Networks
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Flipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-ritFlipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-rit
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Web services-Notes
Web services-NotesWeb services-Notes
Building Service Oriented Architecture based applications
Building Service Oriented Architecture based applicationsBuilding Service Oriented Architecture based applications
Building Service Oriented Architecture based applications
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Innovative Practice-ZigSaw
Innovative Practice-ZigSaw Innovative Practice-ZigSaw
SOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented ArchitectureSOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented Architecture
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Innovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.KaliappanInnovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.Kaliappan
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Service Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML SchemaService Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML Schema
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
IT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notesIT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV scheduleInnovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 

More from Ramco Institute of Technology, Rajapalayam, Tamilnadu, India (20)

AD3251-Data Structures Design-Notes-Tree.pdf
AD3251-Data Structures  Design-Notes-Tree.pdfAD3251-Data Structures  Design-Notes-Tree.pdf
AD3251-Data Structures Design-Notes-Tree.pdf
 
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures  Design-Notes-Searching-Hashing.pdfAD3251-Data Structures  Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
 
ASP.NET-stored procedure-manual
ASP.NET-stored procedure-manualASP.NET-stored procedure-manual
ASP.NET-stored procedure-manual
 
Mobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and ApplicationsMobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and Applications
 
CS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and AnswerCS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and Answer
 
Mobile computing Unit III MANET Notes
Mobile computing Unit III MANET NotesMobile computing Unit III MANET Notes
Mobile computing Unit III MANET Notes
 
Unit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systemsUnit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systems
 
Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020
 
Virtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc NetworksVirtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc Networks
 
Flipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-ritFlipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-rit
 
Web services-Notes
Web services-NotesWeb services-Notes
Web services-Notes
 
Building Service Oriented Architecture based applications
Building Service Oriented Architecture based applicationsBuilding Service Oriented Architecture based applications
Building Service Oriented Architecture based applications
 
Innovative Practice-ZigSaw
Innovative Practice-ZigSaw Innovative Practice-ZigSaw
Innovative Practice-ZigSaw
 
SOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented ArchitectureSOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented Architecture
 
Innovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.KaliappanInnovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.Kaliappan
 
Service Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML SchemaService Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML Schema
 
IT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notesIT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notes
 
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV scheduleInnovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
 
IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
 
Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019Soa unit-1-well formed and valid document08.07.2019
Soa unit-1-well formed and valid document08.07.2019
 

Recently uploaded

CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 

Recently uploaded (20)

CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 

Neural networks using tensor flow in amazon deep learning server

  • 1. RAMCO INSTITUTE OF TECHNOLOGY RAJAPALAYAM 13.04.2020 Prepared by Dr.M.Kaliappan, Associate Professor/CSE -------------------------------------------------------------------------------------------------------------------- Topic: Implementation of Regression with Neural Networks using TensorFlow in Amazon Deep Learning Server --------------------------------------------------------------------------------------------------------------------- 1. Visit to https://aws.amazon.com/deep-learning/ 2. Sign in to console , if not, signup with your data and make payment of Rs.2/-
  • 2. 3. Click on services  then, click on EC2 4. Click on EC2 Dashboard and launch instances
  • 3. 5. Press Ctrl+F (search) : Search a keyword deep learning 6. Select Deep learning AMI(Amazon Linux2) 7. Choose an instance type 8. Click Review and launch 9. Click launch
  • 4. 10. Select create a new keypair 11. Give key file name: key(any name) 12. Download key pair A key.pem file is downloaded and saved in your computer(Download section)
  • 5. 13. Select your created instances 14. Click connect button
  • 6. Copy the Public DNS: ec2-3-133-153-1.us-east-2.compute.amazonaws.com 15. Open command prompt  go to Downloads Type the following command ssh -L localhost:8888:localhost:8888 -i key1.pem ec2-user@ec2-3-133-153-1.us-east- 2.compute.amazonaws.com
  • 7. Now, we got Amazon Linux system
  • 8. 16. Type jupyter notebook
  • 9. The jupyter notebook is running at the following URL. 17. Type this URL in browser. Click on new button. Select Environment (conda_tensorflow_p36) Regression with Neural Networks using TensorFlow Keras API (Blue color represents code, copy and paste in jupyter notebook) Figure 1: Neural Network
  • 10. In regression, the computer/machine should be able to predict a value – mostly numeric. Generate Data: Here we are going to generate some data using our own function. This function is a non-linear function and a usual line fitting may not work for such a function def myfunc(x): if x < 30: mult = 10 elif x < 60: mult = 20 else: mult = 50 return x*mult Let us check what does this function return. print(myfunc(10)) print(myfunc(30)) print(myfunc(60)) It should print something like: 100 600 3000 Now, let us generate data. Let us import numpy library as np. here x is a numpy array of input values. Then, we are generating values between 0 and 100 with a gap of 0.01 using arange function. It generates a numpy array. import numpy as np x = np.arange(0, 100, .01) print(x) data: array([0.000e+00, 1.000e-02, 2.000e-02, ..., 9.997e+01, 9.998e+01, 9.999e+01]) To call a function repeatedly on a numpy array we first need to convert the function using vectorize. Afterwards, we are converting 1-D array to 2-D array having only one value in the second dimension – you can think of it as a table of data with only one column. myfuncv = np.vectorize(myfunc) y = myfuncv(x)
  • 11. X = x.reshape(-1, 1) Print(X) [[0.000e+00], [1.000e-02], [2.000e-02], ... [9.997e+01], [9.998e+01], [9.999e+01]] Now, we have X representing the input data with single feature and y representing the output. We will now split this data into two parts: training set (X_train, y_train) and test set (X_test y_test). We are going make neural ne to produce y from X – we are going to test the model on the test set. import sklearn.model_selection as sk X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You can try plotting X vs y, as well as, X_test vs y_test. import matplotlib.pyplot as plt plt.scatter(X_train,y_train) plt.scatter(X_test,y_test) Now, we have X representing the input data with single feature and y representing the output. We will now split this data into two parts: training set (X_train, y_train) and test set (X_test y_test). We are going make neural network learn from training data, and once it has learnt we are going to test the model on the test set. import sklearn.model_selection as sk X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You can try plotting X vs y, as well as, X_test vs y_test. Figure 2: X_train vs y_train Now, we have X representing the input data with single feature and y representing the output. We will now split this data into two parts: training set (X_train, y_train) and test set (X_test twork learn from training data, and once it has learnt – how X_train, X_test, y_train, y_test = sk.train_test_split(X,y,test_size=0.33, random_state = 42) Let us visualize how does our data looks like. Here, we are plotting only X_train vs y_train. You
  • 12. Let us import TensorFlow libraries and check the version. import tensorflow as tf print(tf.__version__) Now, let us create a neural network using Keras API of TensorFlow. # Import the kera modules from keras.layers import Input, Dense from keras.models import Model # This returns a tensor. Since the input only has one column inputs = Input(shape=(1,)) # a layer instance is callable on a tensor, and returns a tensor # To the first layer we are feeding inputs x = Dense(32, activation='relu')(inputs) # To the next layer we are feeding the result of previous call here it is h x = Dense(64, activation='relu')(x) x = Dense(64, activation='relu')(x) # Predictions are the result of the neural network. Notice that the predictions are also having one column. predictions = Dense(1)(x) # This creates a model that includes # the Input layer and three Dense layers model = Model(inputs=inputs, outputs=predictions) # Here the loss function is mse - model.compile(optimizer='rmsprop', loss='mse', Figure 2: X_test vs y_test et us import TensorFlow libraries and check the version. us create a neural network using Keras API of TensorFlow. from keras.layers import Input, Dense from keras.models import Model # This returns a tensor. Since the input only has one column # a layer instance is callable on a tensor, and returns a tensor # To the first layer we are feeding inputs x = Dense(32, activation='relu')(inputs) # To the next layer we are feeding the result of previous call here it is h )(x) x = Dense(64, activation='relu')(x) # Predictions are the result of the neural network. Notice that the predictions are also having one # This creates a model that includes # the Input layer and three Dense layers odel = Model(inputs=inputs, outputs=predictions) Mean Squared Error because it is a regression problem. model.compile(optimizer='rmsprop', # Predictions are the result of the neural network. Notice that the predictions are also having one Mean Squared Error because it is a regression problem.
  • 13. metrics=['mse']) Let us now train the model. First, it would initialize the weights of each neuron with random values and the using backpropagation it is going to tweak the weights in order to get the appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of X at a time. model.fit(X_train, y_train, epochs=500, batch_size=100) # starts training Once we have trained the model. We can do predictions using the predict method of the model. In our case, this model should predict y using X. Let us test it over our test set. Plot the results. y_test = model.predict(X_test) plt.scatter(X_test, y_test) References: 1. https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n eural_networks.htm 2. https://cloudxlab.com/blog/regression . First, it would initialize the weights of each neuron with random values and the using backpropagation it is going to tweak the weights in order to get the appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of model.fit(X_train, y_train, epochs=500, batch_size=100) # starts training Once we have trained the model. We can do predictions using the predict method of the model. In our case, this model should predict y using X. Let us test it over our test set. Plot the results. https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n https://cloudxlab.com/blog/regression-using-tensorflow-keras-api/ . First, it would initialize the weights of each neuron with random values and the using backpropagation it is going to tweak the weights in order to get the appropriate result. Here we are running the iteration 500 times and we are feeding 100 records of Once we have trained the model. We can do predictions using the predict method of the model. In our case, this model should predict y using X. Let us test it over our test set. Plot the results. https://www.tutorialspoint.com/python_deep_learning/python_deep_learning_artificial_n