🟣 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

TermMeaning
tensortensor is an important term in this topic.
KerasHigh-level API used to build neural networks easily.
SequentialSequential is an important term in this topic.
Dense layerDense layer is an important term in this topic.
trainingProcess 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 tf imports 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

  1. Program ko tensorflow-keras-basics.py file me type karke run karein.
  2. Values change karke output compare karein.
  3. building neural networks par ek छोटा example banayen.
  4. 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.

← Back to Python Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।