Python is one of the most popular programming languages for machine learning and it has replaced many languages in the industry, one of the reason is its vast collection of libraries. Python libraries that used in Machine Learning are: Pandas,Matplotlib Numpy, seaborn, Scipy, Scikit-learn ,Natural Language Toolkit (NLTK),TensorFlow, Keras,PyTorch
📅 Duration: 1–2 months 🎯 Goal: Build a rock-solid Python base — the foundation of everything in DS/ML.
- Installation of Python and Setting up the Environment
- Python Interpreter and PEP8
- Python syntax and Data Types
- Python Variables and Constants
- Conditionals, Loops, and Functions
- Data Structures and their use cases
- Installing packages using pip
- File handling (text files, CSV, JSON)
- Modules and Packages
- Data Structures and List comprehensions
- Object-Oriented Programming (OOP) Concepts
- Error & Exception Handling
- Functional Programming (Lambda functions, map, filter, reduce)
- Advanced Python Concepts (Decorators, closures, iterators, generators)
💡 Practice Projects:
- Text file analyzer
- Simple CSV summarizer
- CLI-based calculator
📅 Duration: 1 month 🎯 Goal: Data wrangling + analysis + visualization.
- Install Jupyter Notebook and Introduction to Jupyter Notebook
- NumPy Basics
- NumPy Methods
- NumPy Axis and Random
- Pandas DataFrame
- Pandas Methods
- Pandas Data Preprocessing and Cleaning
- Seaborn Relational Plot
- Seaborn Categorical Plot
💡 Projects:
- EDA (Exploratory Data Analysis) on a real dataset
- Data cleaning automation notebook
📅 Duration: 2 weeks 🎯 Goal: Learn to manage and query structured data.
- RDBMS basics
- MySQL Queries (DDL, DQL, DML, DCL, TCL)
- Relations and Normalization
- Joins and subquery
💡 Projects:
- Build a sample database (e.g., Student Grades / Sales Data)
- Write SQL reports
📅 Duration: 2 weeks 🎯 Goal: Learn data visualization & dashboard building.
- Power BI master classes
💡 Project:
- Create a Sales Dashboard with interactive filters
📅 Duration: 2 months 🎯 Goal: Learn ML algorithms from scratch, implement and evaluate models.
- Introduction to Machine Learning
- Linear Regression | Gradient Descent
- Linear Regression | Gradient Descent with Multiple Inputs
- Linear Regression | Regularization
- Logistic Regression | Gradient Descent
- Logistic Regression | Bias, Variance, and Regularization
- Logistic Regression | Model Evaluation
- Supervised Learning | SVM, KNN, Decision Tree, Random Forests
- Unsupervised Learning | Clustering, Anomaly Detection, Dimensionality Reduction
- Recommender Systems | Collaboration Filtering, Content-Based Filtering
- Reinforcement Learning
💡 Projects:
- House Price Prediction (Regression)
- Credit Risk Classifier
- Movie Recommendation System
📅 Duration: 1 month 🎯 Goal: Build neural networks using TensorFlow or PyTorch.
- Introduction to Deep Learning
- Deep Feedforward Networks | Gradient Based Learning
- Deep Feedforward Networks | Architecture Design
- Deep Feedforward Networks | Back Propagation
- Deep Feedforward Networks | Regularization, Augmentation, Callbacks, Dropout
- Deep Feedforward Networks | Optimizations
💡 Project:
- MNIST Handwritten Digit Classifier
📅 Duration: 1.5 months 🎯 Goal: Train deep learning models on image data.
- Introduction to Computer Vision
- Convolutional Networks | Convolution Operations
- Convolutional Networks | Architecture Design
- Convolutional Networks | PROJECT | Image Classification
- Convolutional Networks | PROJECT | Object Detection
- Convolutional Networks | PROJECT | Image Segmentation
- Advanced Computer Vision | PROJECT | Action Recognition
- Advanced Computer Vision | PROJECT | Generative Adversarial Networks
- Advanced Computer Vision | PROJECT | Image Super Resolution
💡 Projects:
- Object Detection using YOLO/SSD
- GAN for fake image generation
📅 Duration: 2 months 🎯 Goal: Process and generate text/audio with AI.
- Introduction to Natural Language Processing
- Sequence Modeling | Data Preprocessing, Tokenization, Embeddings
- Sequence Modeling | Recurrent Neural Networks
- Sequence Modeling | Encoder-Decoder
- Sequence Modeling | Deep Recurrent Networks
- Sequence Modeling | LSTM, GRU
- Sequence Modeling | PROJECT | Sentiment Analysis
- Sequence Modeling | PROJECT | Text Summarization
- Sequence Modeling | PROJECT | Machine Translation
- Advanced NLP | Transformer
- Advanced NLP | Conformer
- Advanced NLP | PROJECT | LLMs
- Advanced NLP | PROJECT | Audio Speech Recognition
💡 Projects:
- Sentiment Classifier
- Text Summarizer using LSTM
- Language Translator using Transformer
- Audio to Text Speech Recognizer
📅 Duration: 2 weeks 🎯 Goal: Version control, collaboration, and automation.
- Download and Install Git
- Create GitHub profile
- Git SSH
- The Ultimate Git Cheatsheet
- Collaborate with Git and Github
- Github Actions
💡 Practice:
- Push projects to GitHub
- Automate build/test with GitHub Actions
📅 Duration: 2 weeks 🎯 Goal: Learn automation pipelines for ML projects.
- Understand CI/CD
- Create CI/CD pipeline for projects
- Deploy projects
💡 Project:
- Auto-deploy ML API using CI/CD pipeline
📅 Duration: 2 weeks 🎯 Goal: Containerize apps for production.
- Understand Docker basics
- Dockerize your project
💡 Project:
- Containerize ML Flask/FastAPI app
📅 Duration: 1 month 🎯 Goal: Manage end-to-end ML lifecycle.
- Machine Learning Workflow
- Experiment Management
- ML Endpoint API Development using Flask / FastAPI
- CI/CD Pipeline and Deployment
💡 Project:
- MLOps pipeline with model retraining + deployment
📅 Duration: 2 weeks 🎯 Goal: Learn to deploy models for public use.
- CI/CD Concept
- Deploy your models
💡 Project:
- Deploy trained model on Render / AWS / GCP
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Flatten, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
# Define input shape and number of classes
input_shape = (64, 64, 3) # Example: 64x64 RGB images
num_classes = 10 # Example: 10 classes
# Define the model
input_layer = Input(shape=input_shape)
# Convolutional and pooling layers
x = Conv2D(32, (3, 3), activation="relu", padding="same")(input_layer)
x = MaxPooling2D((2, 2), padding="same")(x)
x = Conv2D(64, (3, 3), activation="relu", padding="same")(x)
x = MaxPooling2D((2, 2), padding="same")(x)
# Flatten and fully connected layers
x = Flatten()(x)
x = Dense(128, activation="relu")(x)
# Output layer
output_layer = Dense(num_classes, activation="softmax")(x)
# Create the model
model = Model(inputs=input_layer, outputs=output_layer)
# Compile the model
model.compile(
optimizer=Adam(learning_rate=0.001),
loss="categorical_crossentropy",
metrics=["accuracy"]
)
# Model summary
model.summary()-
Conv2D Layers:
- The first convolutional layer has 32 filters and uses a 3x3 kernel size.
- The second convolutional layer doubles the filters to 64 for deeper feature extraction.
-
MaxPooling2D Layers:
- Pooling layers reduce spatial dimensions and computational complexity.
-
Dense Layer:
- A fully connected layer with 128 units acts as the final feature abstraction before the output layer.
-
Output Layer:
- A
Denselayer withnum_classesunits and asoftmaxactivation function for classification.
- A
- Input Layer: Accepts input images of specified shape.
- Convolutional Layers:
- Extract spatial features using 3x3 filters.
- Employ ReLU activation for non-linearity.
- Use
padding="same"to maintain spatial dimensions.
- Max Pooling Layers:
- Downsample feature maps using 2x2 pooling.
- Fully Connected Layers:
- Flatten the feature maps.
- Two dense layers with 4096 neurons each.
- Output Layer:
- Dense layer with
len(classes)neurons. - Uses a softmax activation function to output probabilities for each class.
- Dense layer with
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Flatten, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam# Input layer
input_layer = Input(shape=input_shape)
# Convolutional and pooling layers
x = Conv2D(64, (3, 3), activation="relu", padding="same")(input_layer)
x = Conv2D(64, (3, 3), activation="relu", padding="same")(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding="same")(x)
x = Conv2D(128, (3, 3), activation="relu", padding="same")(x)
x = Conv2D(128, (3, 3), activation="relu", padding="same")(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding="same")(x)
x = Conv2D(256, (3, 3), activation="relu", padding="same")(x)
x = Conv2D(256, (3, 3), activation="relu", padding="same")(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding="same")(x)
x = Conv2D(512, (3, 3), activation="relu", padding="same")(x)
x = Conv2D(512, (3, 3), activation="relu", padding="same")(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding="same")(x)
# Fully connected layers
x = Flatten()(x)
x = Dense(4096, activation="relu")(x)
x = Dense(4096, activation="relu")(x)
# Output layer
output_layer = Dense(len(classes), activation="softmax")(x)
# Model definition
model = Model(inputs=input_layer, outputs=output_layer)model.compile(
optimizer=Adam(learning_rate=0.001),
loss="categorical_crossentropy",
metrics=["accuracy"]
)model.summary()from tensorflow.keras.applications import ResNet50
from tensorflow.keras.layers import Flatten, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
# Load the ResNet50 model with pre-trained weights
resnet_model = ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
# Add custom layers
x = Flatten()(resnet_model.output)
output_layer = Dense(num_classes, activation="softmax")(x)
model_resnet = Model(inputs=resnet_model.input, outputs=output_layer)
model_resnet.compile(optimizer=Adam(learning_rate=0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model_resnet.summary()Model Architecture:
- Deep residual learning framework with skip connections.
Usage: - Excellent for transfer learning, allowing for rapid training on small datasets with good performance.
from tensorflow.keras.applications import InceptionV3
from tensorflow.keras.layers import Flatten, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
# Load the InceptionV3 model with pre-trained weights
inception_model = InceptionV3(weights='imagenet', include_top=False, input_shape=(299, 299, 3))
# Add custom layers
x = Flatten()(inception_model.output)
output_layer = Dense(num_classes, activation="softmax")(x)
model_inception = Model(inputs=inception_model.input, outputs=output_layer)
model_inception.compile(optimizer=Adam(learning_rate=0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model_inception.summary()Model Architecture:
- Inception modules that allow for multiple filter sizes at each layer.
Usage:
- Suitable for diverse image recognition tasks with varying object scales.
from tensorflow.keras.applications import VGG16
from tensorflow.keras.layers import Flatten, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
# Load the VGG-16 model with pre-trained weights
vgg_model = VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
# Add custom layers
x = Flatten()(vgg_model.output)
output_layer = Dense(num_classes, activation="softmax")(x)
model_vgg = Model(inputs=vgg_model.input, outputs=output_layer)
model_vgg.compile(optimizer=Adam(learning_rate=0.001), loss="categorical_crossentropy", metrics=["accuracy"])
model_vgg.summary()Model Architecture:
- Sequential architecture with small filters and deep layers.
Usage:
- Well-suited for high-resolution image classification tasks.
| Feature | Deep Custom CNN | Lightweight CNN | Pretrained ResNet50 | Pretrained InceptionV3 | Pretrained VGG-16 |
|---|---|---|---|---|---|
| Input Shape | Variable (depends on dataset) | (64, 64, 3) | (224, 224, 3) | (299, 299, 3) | (224, 224, 3) |
| Layers | Deep Conv2D + MaxPooling | Fewer Conv2D + MaxPooling | ResNet with skip connections | Inception modules | Deep Conv2D |
| Trainable Parameters | High | Low | High | High | High |
| Transfer Learning | No | No | Yes | Yes | Yes |
| Best For | Complex datasets | Fast training on small datasets | Small datasets | Diverse image recognition | High-resolution tasks |
- Convolutional Encoder: Uses convolutional layers to extract features and down-sample the input data into a latent representation.
- Convolutional Decoder: Uses transposed convolutional layers to reconstruct the input data from the latent representation.
- Customizable Latent Dimension: The latent space dimension can be adjusted to control the compression level.
- Configurable Input Shape: The model supports inputs of arbitrary dimensions (e.g., images with different sizes and channels).
- MSE Loss: The autoencoder minimizes the mean squared error (MSE) loss to optimize reconstruction quality.
The encoder consists of:
- Input Layer: Accepts input data of specified shape.
- Convolutional Layers: Extract features with increasing filters (32, 64, 128, 256) and ReLU activation.
- Max Pooling Layers: Down-sample spatial dimensions.
- Flatten Layer: Converts feature maps to a 1D vector.
- Dense Layer (Bottleneck): Compresses the features into a latent space representation of size
latent_dim.
The decoder consists of:
- Input Layer: Accepts latent space vectors.
- Dense Layer: Expands the latent vector back into spatial dimensions.
- Reshape Layer: Converts the expanded vector into feature maps.
- Transposed Convolutional Layers: Reconstruct the input using filters (256, 128, 64, 32) and ReLU activation.
- Upsampling Layers: Increase spatial dimensions back to the original input size.
- Output Layer: Produces the final reconstructed image with a sigmoid activation.
The autoencoder combines the encoder and decoder into a single model:
- Input: Original data (e.g., images).
- Output: Reconstructed data.
- Input Shape:
(32, 32, 3)(default; configurable). - Latent Dimension:
128(default; configurable). - Loss Function: Mean Squared Error (MSE).
- Optimizer: Adam.
from tensorflow.keras import layers, Model
def build_encoder(input_shape, latent_dim):
encoder_input = layers.Input(shape=input_shape, name="encoder_input")
x = layers.Conv2D(32, (3, 3), activation="relu", padding="same")(encoder_input)
x = layers.MaxPooling2D((2, 2), padding="same")(x)
x = layers.Conv2D(64, (3, 3), activation="relu", padding="same")(x)
x = layers.MaxPooling2D((2, 2), padding="same")(x)
x = layers.Conv2D(128, (3, 3), activation="relu", padding="same")(x)
x = layers.MaxPooling2D((2, 2), padding="same")(x)
x = layers.Conv2D(256, (3, 3), activation="relu", padding="same")(x)
x = layers.MaxPooling2D((2, 2), padding="same")(x)
x = layers.Flatten()(x)
bottleneck = layers.Dense(latent_dim, activation="relu", name="bottleneck")(x)
return Model(encoder_input, bottleneck, name="encoder")
def build_decoder(latent_dim, output_shape):
decoder_input = layers.Input(shape=(latent_dim,), name="decoder_input")
x = layers.Dense(2 * 2 * 256, activation="relu")(decoder_input)
x = layers.Reshape((2, 2, 256))(x)
x = layers.Conv2DTranspose(256, (3, 3), activation="relu", padding="same")(x)
x = layers.UpSampling2D((2, 2))(x)
x = layers.Conv2DTranspose(128, (3, 3), activation="relu", padding="same")(x)
x = layers.UpSampling2D((2, 2))(x)
x = layers.Conv2DTranspose(64, (3, 3), activation="relu", padding="same")(x)
x = layers.UpSampling2D((2, 2))(x)
x = layers.Conv2DTranspose(32, (3, 3), activation="relu", padding="same")(x)
x = layers.UpSampling2D((2, 2))(x)
decoder_output = layers.Conv2DTranspose(output_shape[-1], (3, 3), activation="sigmoid", padding="same", name="decoder_output")(x)
return Model(decoder_input, decoder_output, name="decoder")
def build_autoencoder(input_shape, latent_dim):
encoder = build_encoder(input_shape, latent_dim)
decoder = build_decoder(latent_dim, input_shape)
autoencoder_input = layers.Input(shape=input_shape, name="autoencoder_input")
encoded = encoder(autoencoder_input)
decoded = decoder(encoded)
autoencoder = Model(autoencoder_input, decoded, name="autoencoder")
return autoencoder, encoder, decoder
# Define input shape and latent space dimension
input_shape = (32, 32, 3)
latent_dim = 128
# Build the autoencoder
autoencoder, encoder, decoder = build_autoencoder(input_shape, latent_dim)
# Compile the autoencoder
autoencoder.compile(optimizer="adam", loss="mse")
# Display the model architecture
autoencoder.summary()# Define input shape and latent space dimension
input_shape = (32, 32, 3)
latent_dim = 128
# Build the autoencoder
autoencoder, encoder, decoder = build_autoencoder(input_shape, latent_dim)
# Compile the autoencoder
autoencoder.compile(optimizer="adam", loss="mse")# Train the autoencoder
history = autoencoder.fit(x_train, x_train, epochs=20, batch_size=64, validation_data=(x_val, x_val))# Encode and decode an image
encoded_img = encoder.predict(x_test)
decoded_img = decoder.predict(encoded_img)- Fully Convolutional Network: The model consists of an encoder, bottleneck, and decoder structure.
- Skip Connections: Uses
concatenateto merge encoder and decoder layers for precise localization. - Binary Segmentation: Outputs a single-channel mask with pixel values between 0 and 1.
- Functional API: Simplified implementation without object-oriented programming (OOP).
- Encoder: Repeated convolution and max-pooling layers to capture spatial features.
- Bottleneck: Dense feature representation at the narrowest part of the U.
- Decoder: Up-sampling with skip connections for accurate reconstruction.
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, concatenate
def unet(input_size=(128, 128, 3)):
inputs = Input(input_size)
# Down-sampling path
conv1 = Conv2D(64, (3, 3), activation='relu', padding='same')(inputs)
conv1 = Conv2D(64, (3, 3), activation='relu', padding='same')(conv1)
pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)
conv2 = Conv2D(128, (3, 3), activation='relu', padding='same')(pool1)
conv2 = Conv2D(128, (3, 3), activation='relu', padding='same')(conv2)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
conv3 = Conv2D(256, (3, 3), activation='relu', padding='same')(pool2)
conv3 = Conv2D(256, (3, 3), activation='relu', padding='same')(conv3)
pool3 = MaxPooling2D(pool_size=(2, 2))(conv3)
conv4 = Conv2D(512, (3, 3), activation='relu', padding='same')(pool3)
conv4 = Conv2D(512, (3, 3), activation='relu', padding='same')(conv4)
pool4 = MaxPooling2D(pool_size=(2, 2))(conv4)
# Bottleneck
conv5 = Conv2D(1024, (3, 3), activation='relu', padding='same')(pool4)
conv5 = Conv2D(1024, (3, 3), activation='relu', padding='same')(conv5)
# Up-sampling path
up6 = UpSampling2D(size=(2, 2))(conv5)
up6 = Conv2D(512, (2, 2), activation='relu', padding='same')(up6)
merge6 = concatenate([conv4, up6], axis=3)
conv6 = Conv2D(512, (3, 3), activation='relu', padding='same')(merge6)
conv6 = Conv2D(512, (3, 3), activation='relu', padding='same')(conv6)
up7 = UpSampling2D(size=(2, 2))(conv6)
up7 = Conv2D(256, (2, 2), activation='relu', padding='same')(up7)
merge7 = concatenate([conv3, up7], axis=3)
conv7 = Conv2D(256, (3, 3), activation='relu', padding='same')(merge7)
conv7 = Conv2D(256, (3, 3), activation='relu', padding='same')(conv7)
up8 = UpSampling2D(size=(2, 2))(conv7)
up8 = Conv2D(128, (2, 2), activation='relu', padding='same')(up8)
merge8 = concatenate([conv2, up8], axis=3)
conv8 = Conv2D(128, (3, 3), activation='relu', padding='same')(merge8)
conv8 = Conv2D(128, (3, 3), activation='relu', padding='same')(conv8)
up9 = UpSampling2D(size=(2, 2))(conv8)
up9 = Conv2D(64, (2, 2), activation='relu', padding='same')(up9)
merge9 = concatenate([conv1, up9], axis=3)
conv9 = Conv2D(64, (3, 3), activation='relu', padding='same')(merge9)
conv9 = Conv2D(64, (3, 3), activation='relu', padding='same')(conv9)
conv9 = Conv2D(2, (3, 3), activation='relu', padding='same')(conv9)
outputs = Conv2D(1, (1, 1), activation='sigmoid')(conv9)
model = tf.keras.Model(inputs=inputs, outputs=outputs)
return model
# Create the model
model = unet(input_size=(128, 128, 3))
model.summary()Here's a GitHub README template for the provided neural network code:
- Batch Normalization: Stabilizes and accelerates training by normalizing the activations.
- Dropout: Reduces overfitting by randomly dropping neurons during training.
- Global Average Pooling 2D: Minimizes parameters by reducing each feature map to a single value.
- Modular Design: Easily adaptable for different datasets and tasks.
import tensorflow as tf
from tensorflow.keras import layers, models
# Define the model
def create_simple_model(input_shape, num_classes):
model = models.Sequential()
# Input Layer
model.add(layers.Input(shape=input_shape))
# Convolutional Layer 1
model.add(layers.Conv2D(32, (3, 3), activation='relu', padding='same'))
model.add(layers.BatchNormalization()) # Batch Normalization
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Dropout(0.25)) # Dropout
# Convolutional Layer 2
model.add(layers.Conv2D(64, (3, 3), activation='relu', padding='same'))
model.add(layers.BatchNormalization()) # Batch Normalization
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Dropout(0.25)) # Dropout
# Convolutional Layer 3
model.add(layers.Conv2D(128, (3, 3), activation='relu', padding='same'))
model.add(layers.BatchNormalization()) # Batch Normalization
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Dropout(0.25)) # Dropout
# Global Average Pooling 2D
model.add(layers.GlobalAveragePooling2D())
# Fully Connected Layer
model.add(layers.Dense(128, activation='relu'))
model.add(layers.BatchNormalization()) # Batch Normalization
model.add(layers.Dropout(0.5)) # Dropout
# Output Layer
model.add(layers.Dense(num_classes, activation='softmax'))
return model
# Parameters
input_shape = (64, 64, 3) # Example: 64x64 RGB images
num_classes = 10 # Example: 10 classes for classification
# Create and compile the model
model = create_simple_model(input_shape, num_classes)
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
# Summary of the model
model.summary()- Input Layer: Accepts input images of shape
(64, 64, 3)(can be adjusted for your dataset). - Convolutional Layers:
- Three convolutional layers with 32, 64, and 128 filters respectively.
- Each convolutional layer is followed by Batch Normalization, MaxPooling, and Dropout.
- Global Average Pooling: Aggregates the spatial dimensions of feature maps to a single value.
- Dense Layers:
- A fully connected layer with 128 neurons for feature extraction.
- Batch Normalization and Dropout (50%) are applied.
- Output Layer: A softmax layer for multi-class classification with
num_classesoutputs.
