🟣 ML + AI · Lesson 64
TensorFlow और Keras Basics
TensorFlow और Keras Basics क्या है?
TensorFlow और Keras Basics ka matlab hai: TensorFlow and Keras are used to build, train and evaluate deep learning models. Simple words me, ye topic practical Python programs likhne me direct use hota hai.
Is topic ko sirf definition ke liye nahi, balki building neural networks jaise real examples ke liye practice karein.
यह क्यों सीखना जरूरी है?
- Ye building neural networks me kaam aata hai.
- Ye training deep learning models se bhi connected hai.
- Isse aap code ka output aur errors better samajh paate hain.
Important Terms
| Term | Meaning |
|---|---|
| tensor | tensor is an important term in this topic. |
| Keras | High-level API used to build neural networks easily. |
| Sequential | Sequential is an important term in this topic. |
| Dense layer | Dense layer is an important term in this topic. |
| training | Process where a model learns from data. |
Syntax / Basic Pattern
Basic idea: pehle data तैयार करें, phir Python logic apply करें, aur finally result display करें.
Basic Pattern
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Dense(8, activation="relu", input_shape=(2,)),
tf.keras.layers.Dense(1, activation="sigmoid")
])
model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"])
model.summary()Complete Example Program
Python – tensorflow-keras-basics.py
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Dense(8, activation="relu", input_shape=(2,)),
tf.keras.layers.Dense(1, activation="sigmoid")
])
model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"])
model.summary()Expected Output
Model summary with layers and parameters will be displayed.
Program Explanation
import tensorflow as tfimports ready-made features from a module/library.model = tf.keras.Sequential([stores a value in model.tf.keras.layers.Dense(8, activation="relu", input_shape=(2,)),stores a value in tf.keras.layers.Dense(8, activation.tf.keras.layers.Dense(1, activation="sigmoid")stores a value in tf.keras.layers.Dense(1, activation.])performs the next step of the program logic.model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"]stores a value in model.compile(optimizer.model.summary()performs the next step of the program logic.
Practical Uses
- Building neural networks.
- Training deep learning models.
- Using keras layers.
Common Mistakes
- Training and testing the model on the same data.
- Using an algorithm without understanding the input features.
- Reporting only accuracy without checking actual mistakes and limitations.
Practice Tasks
- Program ko
tensorflow-keras-basics.pyfile me type karke run karein. - Values change karke output compare karein.
- building neural networks par ek छोटा example banayen.
- Logic ko apne words me 5 lines me likhein.
सारांश
TensorFlow and Keras Basics ko tab complete maanenge jab aap iska meaning, example, output aur practical use clearly explain kar saken.