SlideShare a Scribd company logo
KERAS
www.1stepgrow.com
PYTHON FOR
PYTHON FOR
DATA SCIENCE
DATA SCIENCE
CHEAT SHEET PART- 1
www.1stepgrow.com
Keras is a powerful and easy-to-use deep learning library for Theano
and TensorFlow that provides a high-level neural networks API to
develop and evaluate deep learning models.
>>> import numpy as np
>>> from keras.models import Sequential
>>> from keras.layers import Dense
>>> data = np.random.random((1000,100))
>>> labels = np.random.randint(2,size=(1000,1))
>>> model = Sequential()
>>> model.add(Dense(32, activation='relu', input_dim=100))
>>> model.add(Dense(1, activation='sigmoid'))
>>> model.compile(optimizer='rmsprop', loss='binary_crossentropy',
metrics=['accuracy'])
>>> model.fit(data,labels,epochs=10,batch_size=32)
>>> predictions = model.predict(data)
A Basic Example
www.1stepgrow.com
>>> from keras.preprocessing import sequence
>>> x_train4 = sequence.pad_sequences(x_train4,maxlen=80)
>>> x_test4 = sequence.pad_sequences(x_test4,maxlen=80)
>>> from keras.models import Sequential
>>> model = Sequential()
>>> model2 = Sequential()
>>> model3 = Sequential()
>>> from keras.utils import to_categorical
>>> Y_train = to_categorical(y_train, num_classes)
>>> Y_test = to_categorical(y_test, num_classes)
>>> Y_train3 = to_categorical(y_train3, num_classes)
>>> Y_test3 = to_categorical(y_test3, num_classes)
Sequence Padding
Sequential Model
One-Hot Encoding
Preprocessing
Model Architecture
www.1stepgrow.com
>>> from sklearn.model_selection import train_test_split
>>> X_train5,X_test5,y_train5,y_test5 = train_test_split
(X, y,test_size=0.33,random_state=42)
>>> from sklearn.preprocessing import StandardScaler
>>> scaler = StandardScaler().fit(x_train2)
>>> standardized_X = scaler.transform(x_train2)
>>> standardized_X_test = scaler.transform(x_test2)
Train and Test Sets
Standardization/Normalization
Preprocessing
Build your career story with
1stepGrow Academy
Follow 1stepGrow Academy
Save the Post
Share your Comments
www.1stepgrow.com

More Related Content

PDF
Keras cheat sheet_python
PPTX
Mata Kuliah AI_Pengenalan Library Python.pptx
PPTX
Deep Learning with Apache MXNet (September 2017)
PPTX
INTRODUCTION TO KERAS FOR BEGINNERS.pptx
PDF
Neural networks using tensor flow in amazon deep learning server
PDF
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
PPTX
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
PDF
Keras and TensorFlow
Keras cheat sheet_python
Mata Kuliah AI_Pengenalan Library Python.pptx
Deep Learning with Apache MXNet (September 2017)
INTRODUCTION TO KERAS FOR BEGINNERS.pptx
Neural networks using tensor flow in amazon deep learning server
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
wepik-breaking-down-spam-detection-a-deep-learning-approach-with-tensorflow-a...
Keras and TensorFlow

Similar to The Ultimate Keras Cheat Sheet for Deep Learning! (20)

PPTX
Introduction To Tensorflow
PDF
TensorFlow In 10 Minutes | Deep Learning & TensorFlow | Edureka
PPTX
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
PPTX
TypeScript and Deep Learning
PDF
iOS와 케라스의 만남
PDF
Power ai tensorflowworkloadtutorial-20171117
PDF
PDF
프알못의 Keras 사용기
PPTX
Image classification using cnn
PDF
Introducing Reactive Machine Learning
PPTX
D3, TypeScript, and Deep Learning
PDF
Deep Dive on Deep Learning (June 2018)
PPT
UNIT III_Python Programming_aditya COllege
PPT
UNIT III_Python Programming_aditya COllege
PDF
Numpy_Cheat_Sheet.pdf
PPTX
Diving into Deep Learning (Silicon Valley Code Camp 2017)
PDF
Feature Engineering - Getting most out of data for predictive models
PDF
Cheat sheets for AI
PPTX
D3, TypeScript, and Deep Learning
PDF
Deep Learning for Computer Vision: Software Frameworks (UPC 2016)
Introduction To Tensorflow
TensorFlow In 10 Minutes | Deep Learning & TensorFlow | Edureka
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
TypeScript and Deep Learning
iOS와 케라스의 만남
Power ai tensorflowworkloadtutorial-20171117
프알못의 Keras 사용기
Image classification using cnn
Introducing Reactive Machine Learning
D3, TypeScript, and Deep Learning
Deep Dive on Deep Learning (June 2018)
UNIT III_Python Programming_aditya COllege
UNIT III_Python Programming_aditya COllege
Numpy_Cheat_Sheet.pdf
Diving into Deep Learning (Silicon Valley Code Camp 2017)
Feature Engineering - Getting most out of data for predictive models
Cheat sheets for AI
D3, TypeScript, and Deep Learning
Deep Learning for Computer Vision: Software Frameworks (UPC 2016)
Ad

More from 1stepgrow (20)

PPTX
Top Advanced Data Science Course in 2025
PDF
Advanced Data Science Course Online in 2025
PDF
Difference between Data Science and Artificial Intelligence.pdf
PDF
What is the job for artificial intelligence and data science.pdf
PDF
Which has more salary AI or Data Science
PDF
difference between Machine Learning and Deep Learning
PDF
Python Libraries For Data Science in 2025
PDF
What Does A Python Developer Do in 2025 ?
PDF
Top 5 data science jobs in 2025 for freshers.pdf
PDF
1stepGrow Top 5 Data science jobs in 2025
PDF
Master Business Intelligence: From Data Extraction to Actionable Insights! 🚀
PDF
Data Analyst Roadmap – Key Steps to Master Data Science!
PDF
Crack Your Amazon Interview Like a Pro! #Datascience
PDF
AI Superintelligence: A Game-Changer or a Risk?
PDF
How AI Is Transforming the World – Are You Ready?
PDF
How ATS Reads Your Resume – And Why It Matters!
PDF
How AI Powers Netflix, Prime Video & More!
PDF
Top Interview Questions for MAANG Data Science & AI Roles
PDF
Seaborn Cheat Sheet – Quick Guide to Regression, Distplot & Matrix Plots!
PDF
Python for data science! #Datascience #Python
Top Advanced Data Science Course in 2025
Advanced Data Science Course Online in 2025
Difference between Data Science and Artificial Intelligence.pdf
What is the job for artificial intelligence and data science.pdf
Which has more salary AI or Data Science
difference between Machine Learning and Deep Learning
Python Libraries For Data Science in 2025
What Does A Python Developer Do in 2025 ?
Top 5 data science jobs in 2025 for freshers.pdf
1stepGrow Top 5 Data science jobs in 2025
Master Business Intelligence: From Data Extraction to Actionable Insights! 🚀
Data Analyst Roadmap – Key Steps to Master Data Science!
Crack Your Amazon Interview Like a Pro! #Datascience
AI Superintelligence: A Game-Changer or a Risk?
How AI Is Transforming the World – Are You Ready?
How ATS Reads Your Resume – And Why It Matters!
How AI Powers Netflix, Prime Video & More!
Top Interview Questions for MAANG Data Science & AI Roles
Seaborn Cheat Sheet – Quick Guide to Regression, Distplot & Matrix Plots!
Python for data science! #Datascience #Python
Ad

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Classroom Observation Tools for Teachers
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Basic Mud Logging Guide for educational purpose
PDF
Insiders guide to clinical Medicine.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
master seminar digital applications in india
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cell Types and Its function , kingdom of life
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
TR - Agricultural Crops Production NC III.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial diseases, their pathogenesis and prophylaxis
Classroom Observation Tools for Teachers
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Basic Mud Logging Guide for educational purpose
Insiders guide to clinical Medicine.pdf
Sports Quiz easy sports quiz sports quiz
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
STATICS OF THE RIGID BODIES Hibbelers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
master seminar digital applications in india
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Cell Types and Its function , kingdom of life
Pharmacology of Heart Failure /Pharmacotherapy of CHF
102 student loan defaulters named and shamed – Is someone you know on the list?
TR - Agricultural Crops Production NC III.pdf

The Ultimate Keras Cheat Sheet for Deep Learning!

  • 1. KERAS www.1stepgrow.com PYTHON FOR PYTHON FOR DATA SCIENCE DATA SCIENCE CHEAT SHEET PART- 1
  • 2. www.1stepgrow.com Keras is a powerful and easy-to-use deep learning library for Theano and TensorFlow that provides a high-level neural networks API to develop and evaluate deep learning models. >>> import numpy as np >>> from keras.models import Sequential >>> from keras.layers import Dense >>> data = np.random.random((1000,100)) >>> labels = np.random.randint(2,size=(1000,1)) >>> model = Sequential() >>> model.add(Dense(32, activation='relu', input_dim=100)) >>> model.add(Dense(1, activation='sigmoid')) >>> model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy']) >>> model.fit(data,labels,epochs=10,batch_size=32) >>> predictions = model.predict(data) A Basic Example
  • 3. www.1stepgrow.com >>> from keras.preprocessing import sequence >>> x_train4 = sequence.pad_sequences(x_train4,maxlen=80) >>> x_test4 = sequence.pad_sequences(x_test4,maxlen=80) >>> from keras.models import Sequential >>> model = Sequential() >>> model2 = Sequential() >>> model3 = Sequential() >>> from keras.utils import to_categorical >>> Y_train = to_categorical(y_train, num_classes) >>> Y_test = to_categorical(y_test, num_classes) >>> Y_train3 = to_categorical(y_train3, num_classes) >>> Y_test3 = to_categorical(y_test3, num_classes) Sequence Padding Sequential Model One-Hot Encoding Preprocessing Model Architecture
  • 4. www.1stepgrow.com >>> from sklearn.model_selection import train_test_split >>> X_train5,X_test5,y_train5,y_test5 = train_test_split (X, y,test_size=0.33,random_state=42) >>> from sklearn.preprocessing import StandardScaler >>> scaler = StandardScaler().fit(x_train2) >>> standardized_X = scaler.transform(x_train2) >>> standardized_X_test = scaler.transform(x_test2) Train and Test Sets Standardization/Normalization Preprocessing
  • 5. Build your career story with 1stepGrow Academy Follow 1stepGrow Academy Save the Post Share your Comments www.1stepgrow.com