Posts

scikit tutorial

1. What is scikit-learn? scikit-learn is a popular Python library for Machine Learning . It gives you ready-made tools for: Classification (spam vs not-spam) Regression (predicting house prices) Clustering (grouping customers) Dimensionality reduction (PCA) Model selection & evaluation Preprocessing (scaling, encoding, etc.) It’s built on top of NumPy , SciPy , and Matplotlib . 2. Install & Basic Setup Installation pip install scikit-learn In Google Colab , you usually already have it. If not: !pip install scikit-learn Basic Imports import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score 3. Core Concepts in scikit-learn If you understand these 4 things, you understand 80% of sklearn: X and y X → Features (inputs), usually 2D array: shape (n_samples, n_features) y → Target (output labels), 1D array: shape (n_samples,) Estimator API (fit / predict / transform) Models (like LinearRegression , Random...

RAG (Retrieval-Augmented Generation) tutorial

1. What is RAG (Retrieval-Augmented Generation)? Idea: Instead of asking an LLM to answer only from its own training, you: Retrieve relevant documents from your data (PDFs, DB, website, etc.) Augment the prompt with those docs Let the Generator (LLM) answer using that context. So pipeline is: User query ➜ Retrieve top-k docs ➜ Build prompt with docs ➜ LLM answers This solves: Outdated model knowledge Hallucinations (partially) Domain customization (company docs, reports, codebase) 2. High-Level RAG Architecture Think of 2 phases: 2.1. Offline / One-Time: Build Knowledge Store Collect data PDFs, HTML pages, markdown, CSVs, Confluence, Notion, etc. Chunking Split into small text chunks (e.g., 200–500 tokens) with overlap. Why: too big ➜ irrelevant noise; too small ➜ not enough context. Embed chunks Use an embedding model (e.g., OpenAI text-embedding, or local like bge, all-MiniLM, etc.). For each chunk: embedding = embedding_model(chunk_text) Store in Vector DB Store: (id, chunk_text...

Machine learning tutorial

  📘 Definition of Machine Learning Machine learning (ML) is a subfield of artificial intelligence (AI) that focuses on building algorithms and models that can learn patterns from data and make predictions or decisions without being explicitly programmed for each task. Instead of hard-coded rules, ML systems improve their performance as they are exposed to more data. 🔑 Key Points Pattern Recognition : ML algorithms identify hidden structures in datasets and generalize them to new, unseen data. Adaptability : Models evolve dynamically as new data arrives, staying relevant in changing environments. Applications : Used in image and speech recognition, natural language processing, recommendation systems, fraud detection, autonomous vehicles, and generative AI. Types of ML : Supervised Learning : Learns from labeled data (e.g., spam detection). Unsupervised Learning : Finds patterns in unlabeled data (e.g., customer segmentation). Semi-supervised Learning : Mix of labeled a...

PyTorch Tutorial: Beginner to Advanced (Complete Guide 2026)

Image
PyTorch Tutorial: Beginner to Advanced (Complete Guide 2026) 🧠 PyTorch Tutorial: Beginner to Advanced (Complete Guide 2026) Machine Learning and Deep Learning are transforming the world — and PyTorch is one of the most powerful frameworks behind modern AI systems. In this complete guide, you’ll learn PyTorch from beginner to advanced level , with examples and practical explanations. 🚀 What is PyTorch? PyTorch is an open-source deep learning framework developed by Meta (Facebook AI). It is widely used for: Computer Vision Natural Language Processing Reinforcement Learning Research & Production AI 🟢 Level 1: PyTorch Basics (Tensors & Operations) 🔹 What is a Tensor? A tensor is a multi-dimensional array. 0D → Scalar 1D → Vector 2D → Matrix 3D+ → Higher-dimensional tensor ✅ Creating Tensors import torch # 1D tensor x = torch.tensor([1, 2, 3, 4]) print(x) # 2D random tensor rand_tensor = torch.rand((2, 3)) print(rand_tensor) # Zeros & Ones zeros = torch.zeros((2, 3)) o...

TensorFlow tutorial

  🟢 Level 1: Beginner (The Foundation) Goal: Understand how TensorFlow handles data and build your first "Hello World" models. Introduction to Tensors: What are Tensors? (Scalars, Vectors, Matrices). Tensor types and shapes ( tf.constant , tf.Variable ). Basic operations: Addition, matrix multiplication, and reshaping. The Keras Sequential API: Building simple Dense (Linear) layers. Compiling models: Selection of Optimizers (Adam, SGD) and Loss Functions (MSE, Binary Cross-Entropy). Data Preprocessing Basics: Using tf.data.Dataset for efficient data pipelines. Normalizing and scaling numerical data. Hands-on Project: Predicting house prices using a Simple Linear Regression model. 🟡 Level 2: Intermediate (Computer Vision & NLP) Goal: Build models that can see and read. Computer Vision with CNNs: Convolutional layers, Pooling, and Dropout. Image Augmentation: Flipping, rotating, and zooming to prevent overfitting. Transfer Learning: Using pre-trained models like Mob...