Nipun Batra Blog
  • Homepage
Categories
All (153)
academia (2)
adagrad (1)
adversarial-networks (1)
agent-loop (1)
AI (1)
ai (1)
air quality (1)
algorithms (2)
Apple-Silicon (2)
approximate-inference (1)
async (1)
attention-mechanism (2)
audio (3)
audio-tags (1)
auto-detection (1)
automated-machine-learning (1)
automation (2)
automl (1)
Batching (1)
bayesian (5)
benchmarks (2)
brick-kilns (1)
browser (1)
caching (1)
chain-of-thought (1)
classifier (1)
CLIP (1)
clustering (1)
code-execution (1)
collaborative-filtering (1)
comparison (1)
compression (1)
Computer Vision (1)
computer vision (1)
computer-vision (3)
cuda (1)
data visualization (1)
data-aggregation (1)
data-analysis (3)
data-visualization (1)
deep learning (4)
Deep Learning (1)
deep-learning (16)
denoising (1)
development-environment (2)
diffusion (1)
digital-signal-processing (1)
dimensionality-reduction (1)
distance-metrics (1)
distillation (1)
document-understanding (1)
dynamic-time-warping (1)
earth-observation (1)
educational (7)
environmental-monitoring (2)
evaluation (2)
expectation-maximization (1)
Falcon-Perception (3)
feature-extraction (1)
filtering (1)
fine-tuning (1)
forecasting (1)
function-calling (1)
gaussian-processes (1)
Gemini (5)
Gemini-3-Pro (3)
gemma (1)
Gemma-4 (5)
generative-models (1)
geospatial (1)
ggplot (1)
gibbs-sampling (1)
github-actions (1)
google-earth-engine (1)
gpu (1)
gradient-descent (1)
grounded-reasoning (2)
hidden-markov-models (1)
Hindi (1)
hyperparameter-optimization (1)
image-editing (1)
image-generation (1)
image-processing (1)
instruction-following (1)
instruction-tuning (3)
interleaved (1)
interpretability (1)
ios (2)
ipad (2)
jax (1)
JAX (1)
keras (2)
kernel-methods (1)
keyboard-shortcuts (1)
LA (1)
LaTeX (1)
linear-algebra (1)
linear-regression (2)
linux (1)
LLM (13)
llm (1)
local-inference (3)
machine learning (2)
macos (3)
markdown (1)
math-OCR (1)
matrix-decomposition (1)
mcmc (2)
mcp (1)
missing data (1)
mixture-models (1)
ML (89)
ml (2)
MLX (4)
mlx-vlm (1)
MNIST (1)
mobile-development (1)
monte-carlo (1)
multi-image (1)
multi-label classification (1)
multi-task (1)
multilingual (1)
multimodal (13)
natural language processing (1)
networking (1)
neural-architecture-search (1)
neural-networks (5)
news (1)
nlp (2)
object-detection (4)
OCR (1)
optimization (3)
pandas (1)
parameter-estimation (1)
Performance (1)
performance (2)
PIL (1)
plotnine (1)
polygon (1)
privacy (1)
probabilistic-models (7)
productivity (7)
pruning (1)
python (4)
Python (1)
pytorch (6)
PyTorch (3)
quantization (1)
quarto (1)
reasoning (2)
recommendation-systems (1)
referring-expression (1)
remote (1)
remote-development (1)
remote-sensing (1)
robust models (1)
SAM3 (3)
sampling-methods (1)
satellite (1)
satellite-imagery (3)
scipy (1)
scp (1)
segmentation (5)
SentinelKilnDB (1)
sequence modeling (1)
sequence-alignment (1)
sequence-modeling (2)
sequence-to-sequence (1)
setup (7)
shortcuts (2)
signal-processing (2)
simulation (1)
sleep (1)
softmax (1)
SQL (1)
ssh (2)
stable-diffusion (1)
statistics (1)
structured-generation (1)
sustainability (1)
table-extraction (1)
task-routing (1)
teaching (1)
temperature scaling (1)
temporal-analysis (1)
tensorflow (2)
terminal (3)
text generation (1)
text-to-image (1)
TF (3)
TFP (3)
time-series (4)
tools (5)
tracking (2)
transformers (4)
TTS (1)
uncertainty-quantification (2)
unsupervised-learning (1)
variational-inference (1)
video (3)
vision (5)
vision-language (1)
visual-grounding (1)
visual-reasoning (1)
visualisation (3)
visualization (3)
VLM (13)
VQA (1)
vscode (1)
workflow (1)
yolo (1)

Writing

Notes on machine learning, VLMs, and building things.

 

Gemini 3.1 Flash TTS: Audio Tags, English and Hindi in One Notebook

LLM
Gemini
TTS
audio
Hindi
multilingual
audio-tags

Google’s new Gemini 3.1 Flash TTS adds natural-language ‘audio tags’ like [excitement] or [like dracula] that steer voice style inline. I run it in English and Hindi and embed the results.

Apr 16, 2026
Nipun Batra
3 min

Grounded Visual Reasoning on a Mac: a Corridor and a Drone Pan

LLM
mlx-vlm
Gemma-4
Falcon-Perception
MLX
local-inference
grounded-reasoning
video
tracking
Apple-Silicon

Two worked examples — a still photo and a drone video — running Falcon Perception and Gemma 4 locally on an M2 Max. Counts you can audit, from an agent that never does arithmetic in its head.

Apr 16, 2026
Nipun Batra
6 min

Variant C flowchart

Brick Kilns from Above: Gemma 4 Calling Falcon Perception in a Loop

LLM
Falcon-Perception
Gemma-4
MLX
satellite
remote-sensing
brick-kilns
SentinelKilnDB
agent-loop

Hi-res ESRI imagery + Gemma 4 in the PR #926 agent loop on three brick-kiln classes. Twelve tiles, four Falcon queries each, three prompt variants — with per-tile mask grids and Gemma’s reasoning shown. 67% zero-shot, and the remaining 33% is instructive.

Apr 16, 2026
Nipun Batra
11 min

Why VLMs Lie About Numbers (and How to Fix It With Grounding)

LLM
Gemma-4
Falcon-Perception
MLX
local-inference
grounded-reasoning
multimodal

Gemma 4 sounds confident. Falcon Perception actually measures. Together they beat either alone — here is the evidence.

Apr 5, 2026
Nipun Batra
4 min

Gemma 4 Locally on Mac: Performance & Vision Benchmarks

LLM
Gemma-4
MLX
local-inference
multimodal
vision
Apple-Silicon
benchmarks
Google released Gemma 4 yesterday — open-weight multimodal models under Apache 2.0. In a companion post, we compared Gemma 4 and Gemini via the API. Here, we run Gemma 4 enti…
Apr 3, 2026
Nipun Batra
3 min

Gemma 4 vs Gemini: Open-Weight Models Meet the Gemini API

LLM
Gemma-4
Gemini
multimodal
vision
segmentation
comparison
Google just released Gemma 4 — open-weight models (Apache 2.0) available directly through the Gemini API. Same SDK, same API key — just change the model name.
Apr 3, 2026
Nipun Batra
2 min

Concept Bottleneck Models — MNIST Demo

interpretability
deep-learning
pytorch
MNIST
educational
Paper: Koh et al., Concept Bottleneck Models (ICML 2020)
Mar 12, 2026
Nipun Batra
4 min
 

Agentic Browsing with agent-browser

AI
automation
tools

A hands-on guide to automating web browsing for AI agents using agent-browser CLI

Jan 15, 2026
Nipun Batra
4 min
 

Building AI Tool Servers with FastMCP

python
ai
mcp
llm
tools

Learn how to build MCP servers with FastMCP - enabling LLMs like Claude to interact with your custom tools, databases, and APIs.

Jan 13, 2026
Nipun Batra
11 min
 

Brave Browser Setup for Teaching & Presentations

productivity
teaching
privacy
browser

Configure Brave browser to hide personal browsing history during classroom demos and presentations

Jan 4, 2026
Nipun Batra
6 min

VLM for OCR and LaTeX Generation: From Images to Structured Text

VLM
OCR
LaTeX
document-understanding
math-OCR
table-extraction
In this notebook, we explore how Vision-Language Models excel at Optical Character Recognition (OCR) and structured document understanding. We’ll focus on:
Jan 4, 2026
Nipun Batra
4 min
 

Terminal Optimization: A 2026 Refresh

terminal
productivity
macos
tools

A comprehensive terminal optimization covering security fixes, modern tooling, and performance improvements

Jan 3, 2026
Nipun Batra
7 min

VLM-Guided Image Generation: From Text and Images to Pixels

VLM
image-generation
diffusion
stable-diffusion
CLIP
text-to-image
In this notebook, we explore how Vision-Language Models (VLMs) can generate images, not just understand them. We’ll cover:
Jan 3, 2026
Nipun Batra
4 min

VLM Compression: Quantization, Pruning, and Distillation

VLM
compression
quantization
pruning
distillation
optimization
In this notebook, we’ll explore model compression techniques to make Vision-Language Models (VLMs) more efficient without significantly sacrificing performance. We’ll…
Jan 2, 2026
Nipun Batra
4 min

Teaching VLMs to Edit Images with Natural Language

VLM
image-editing
instruction-following
PIL
computer-vision
multimodal
We’ve built VLMs that can describe images, detect objects, answer questions, and even outline objects with polygons. But what if we want to modify images using natural…
Jan 1, 2026
Nipun Batra
6 min

Visual Grounding and Polygon Segmentation with VLMs

VLM
visual-grounding
segmentation
referring-expression
polygon
deep-learning
In our VLM series, we’ve built models that can caption, detect objects, answer questions, and reason step-by-step. But what if we want to:
Dec 31, 2025
Nipun Batra
5 min

Chain-of-Thought Visual Reasoning with VLMs

VLM
chain-of-thought
reasoning
visual-reasoning
multimodal
deep-learning
In our VLM series, we’ve built models that can caption images, detect objects, answer questions, and handle multiple tasks. But can they reason about what they see?
Dec 30, 2025
Nipun Batra
5 min
 

Brick Kiln Detection using SAM3 and Satellite Imagery

SAM3
geospatial
object-detection
satellite-imagery
segmentation
environmental-monitoring
Brick kilns are a significant source of air pollution in India, particularly in the Indo-Gangetic Plain. Monitoring these kilns for environmental compliance is challenging…
Dec 29, 2025
Nipun Batra
4 min

Intelligent Task Routing for Multi-Task VLMs

VLM
task-routing
auto-detection
classifier
multimodal
deep-learning
educational
In the multi-task VLM notebook, we built a model that handles caption, OD, and VQA - but it requires explicit task prompts:
Dec 28, 2025
Nipun Batra
3 min

Multi-Image Vision-Language Model: Compare, Reason, and Understand

VLM
multi-image
interleaved
multimodal
deep-learning
educational
When to clear memory: - After training/evaluation before starting a new notebook - When switching between large models - If you get CUDA out of memory errors
Dec 27, 2025
Nipun Batra
5 min

Multi-Task Vision-Language Model: Caption, Detect, and Answer

VLM
multi-task
instruction-tuning
multimodal
deep-learning
educational
When to clear memory: - After training/evaluation before starting a new notebook - When switching between large models - If you get CUDA out of memory errors
Dec 26, 2025
Nipun Batra
4 min

Instruction Fine-Tuning a VLM for Object Detection

VLM
instruction-tuning
object-detection
multimodal
deep-learning
educational
In the previous notebook, we built a minimal Vision-Language Model (VLM) from scratch and trained it on image captioning. The model learned to describe images in natural…
Dec 25, 2025
Nipun Batra
3 min

Instruction Fine-Tuning a VLM for Visual Question Answering

VLM
instruction-tuning
VQA
multimodal
deep-learning
educational
In previous notebooks, we: 1. Built a minimal VLM from scratch and trained it for image captioning 2. Instruction fine-tuned it for object detection with JSON output
Dec 25, 2025
Nipun Batra
3 min

Building a Minimal Vision-Language Model from Scratch

VLM
vision-language
multimodal
deep-learning
transformers
educational
Vision-Language Models (VLMs) have revolutionized how AI systems understand and reason about images. Models like GPT-4V, LLaVA, and Gemini can describe images, answer…
Dec 24, 2025
Nipun Batra
4 min

Fine-Tuning FunctionGemma for Multi-Table Data Analysis

LLM
fine-tuning
function-calling
gemma
data-analysis
SQL
Consider this realistic scenario:
Dec 24, 2025
Nipun Batra
2 min

SAM3 + Gemini: Intelligent Image Segmentation

SAM3
Gemini
segmentation
vision
multimodal
Meta’s SAM3 introduces text-based prompting for segmentation - just describe what you want to segment. This notebook shows:
Dec 23, 2025
Nipun Batra
1 min

SAM3 Video Tracking: Following a Tennis Ball

SAM3
video
tracking
segmentation
In the previous post, we explored SAM3’s image segmentation. Now let’s use SAM3 for video tracking - following a tennis ball across frames using just a text prompt.
Dec 23, 2025
Nipun Batra
2 min

Gemini Code Execution: See How AI Thinks, Codes, and Analyzes Images

LLM
Gemini
code-execution
computer-vision
reasoning
Gemini’s code execution with images reveals how AI thinks. Instead of just getting an answer, you see:
Dec 19, 2025
Nipun Batra
3 min

Multi-Location Temporal Brick Kiln Analysis Using Async Gemini 3 Pro API

LLM
Gemini-3-Pro
satellite-imagery
temporal-analysis
async
environmental-monitoring
Brick kilns are a significant source of air pollution in India, and monitoring their temporal patterns across multiple locations is crucial for environmental management.…
Dec 17, 2025
Nipun Batra
2 min

Gemini API Performance: Sequential vs Async vs Single-Prompt

LLM
Gemini
Performance
Batching
Python
We often need to process multiple images. The question is: What is the fastest way to do it?
Dec 12, 2025
Nipun Batra
1 min

Testing Gemini 3 Pro: Are VLMs Still Blind and Biased?

LLM
Gemini-3-Pro
vision
VLM
benchmarks
evaluation
In a previous post, we explored Google’s Gemini 3 Pro multimodal capabilities. The model showed impressive performance on object detection, segmentation, and complex visual…
Dec 10, 2025
Nipun Batra
3 min

Gemini-3-Pro: Mastering Multimodal AI Capabilities

LLM
Gemini-3-Pro
multimodal
vision
audio
video
object-detection
Multimodal AI models can understand and generate content across different types of data—text, images, video, audio, and documents—through a unified interface. This notebook…
Dec 6, 2025
Nipun Batra
5 min
 

Structured Outputs: Extraction vs Classification with LLMs

LLM
structured-generation
evaluation
In this post, we compare different approaches for extracting structured information from text using two tasks:
Nov 26, 2025
Nipun Batra
5 min
 

Exploring Satellite Embeddings with Google’s Alpha Earth

satellite-imagery
deep-learning
earth-observation
google-earth-engine
Google’s Alpha Earth project represents a breakthrough in satellite imagery analysis by providing pre-trained deep learning embeddings of Earth’s surface. These embeddings…
Nov 26, 2025
Nipun Batra
5 min

Handling Missing Input Channels with Mask-Aware Neural Networks

machine learning
deep learning
missing data
robust models

Learn how to build neural networks that gracefully handle missing input channels by explicitly encoding missingness patterns

Oct 29, 2025
Nipun Batra
3 min

Vector Search with Text and Images

ML

Understanding vector databases through text and image search

Oct 7, 2025
Nipun Batra
2 min

Using REST APIs in Google Sheets with Apps Script

Learn how to call REST APIs from Google Sheets using a custom Apps Script function.

Aug 24, 2025
Nipun Batra
2 min

DINOv2 vs CNN: Transfer Learning vs Training from Scratch

Deep Learning
Computer Vision

Comparing DINOv2 fine-tuning vs training CNN from scratch for binary image classification

Aug 17, 2025
Nipun Batra
2 min

Visualizing ERA5 Data

ML

Visualizing ERA5 data grid coverage over India

Aug 13, 2025
Nipun Batra
3 min

Temperature Scaling in Softmax: Controlling Randomness in Language Models

deep learning
natural language processing
softmax
temperature scaling
text generation

Exploring how temperature scaling affects the randomness and diversity of language model outputs through mathematical analysis and interactive visualizations

Jul 9, 2025
Nipun Batra
3 min

Multi-Image Classification with VOC Dataset Visualization

computer vision
deep learning
multi-label classification
data visualization

Visualizing and filtering multi-image classification samples from the VOC dataset for improved training data quality

Jul 7, 2025
Nipun Batra
1 min

Logit Masking for Sleep Stage Classification

machine learning
deep learning
sleep
sequence modeling

Demonstrating how logit masking enforces valid transitions in sleep stage classification

Jul 4, 2025
Nipun Batra
3 min
 

Slack Tips for Better Team Management

productivity
tools
Here are some useful Slack tips to improve your team communication and channel management.
Jun 30, 2025
Nipun Batra
1 min
 

Linux Remote Server Setup with uv and CUDA

setup
linux
remote
development-environment
gpu
cuda

Setting up Python Environment on Linux Remote Servers with GPU Support

Jan 15, 2025
Nipun Batra
4 min
 

Faster Quarto Builds with Incremental Rendering and Caching

quarto
github-actions
caching
performance

Tired of waiting 5+ minutes for Quarto to rebuild all 145 posts when you only changed one? Here’s how to make GitHub Actions only rebuild what actually changed.

Jan 8, 2025
Nipun Batra
8 min
 

Parallel File Transfer Over SSH When You Have Thousands of Files

ssh
scp
performance
terminal

Transferring large projects with thousands of small files over SSH can be painfully slow. Here’s how we solved it with parallel transfers.

Jan 7, 2025
Nipun Batra
4 min
 

Keyboard shortcuts on Mac

setup
macos
shortcuts
productivity
keyboard-shortcuts
workflow

Keyboard shortcuts on mac

Jun 12, 2024
3 min

Object detection

ML
computer-vision
object-detection
deep-learning
neural-networks
yolo
pytorch
Code
from ultralytics import YOLO, checks, hub
import pandas as pd
May 30, 2024
Nipun Batra
1 min

Time Series Forecasting - Comparing MLP and Transformer Models

ML
time-series
forecasting
deep-learning
transformers
pytorch
Code
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import torch
import torch.nn as nn
import torch.nn…
May 30, 2024
Nipun Batra
1 min

Character-Level Attention Mechanism for Name Generation

ML
1165 rows × 1 columns
May 30, 2024
Nipun Batra
1 min

Character-Level RNN for Name Generation

ML
1165 rows × 1 columns
May 30, 2024
Nipun Batra
1 min

Attention in Sequence to Sequence

ML
attention-mechanism
sequence-to-sequence
deep-learning
neural-networks
transformers
nlp
pytorch
Code
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
import numpy as np
import matplotlib.pyplot as plt
…
May 30, 2024
Nipun Batra
1 min

Sampling Distribution Analysis - Mean vs Standard Deviation

ML
Code
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import torch
import torch.nn as nn
import torch.nn…
May 7, 2024
Nipun Batra
1 min

Mixture of Experts

ML
Code
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import torch
import torch.nn as nn
import torch.nn…
Jan 18, 2024
Nipun Batra
1 min

Logo

ML
Code
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
Jan 2, 2024
Nipun Batra
1 min

Basic Neural Process

ML
Code
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import torch
import torch.nn as nn
import torch.nn.functional as F
%config…
Dec 28, 2023
Nipun Batra
1 min

Using a neural network as a covariance function

ML
Code
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
# Retina mode
%config InlineBackend.figure_format = 'retina'
Code
# Create…

Dec 22, 2023
Nipun Batra
1 min
 

Towards Transformers

ML
transformers
attention-mechanism
deep-learning
neural-networks
nlp
sequence-modeling
pytorch
Code
import tiktoken
Code
encoding = tiktoken.get_encoding("cl100k_base")
Code
encoding.encode("Hello World! This is a simple notebook")
[9906, 4435, 0, 1115…
Dec 21, 2023
Nipun Batra
1 min

Naive implementation of Strassen’s algorithm

ML
Code
import numpy as np 
import time
import matplotlib.pyplot as plt
import pandas as pd
# Retina display
%config InlineBackend.figure_format = 'retina'
Code
log_size …

Dec 20, 2023
Nipun Batra
1 min
 

YouTube video to transcript using openAI whisper and summary using OLLama

ML
References
Dec 18, 2023
Nipun Batra
1 min

Reinforcement Learning

ML
Reference
Dec 11, 2023
Nipun Batra
1 min

Super Resolution using U-Net like architecture

ML
Code
import matplotlib.pyplot as plt
import torch

%matplotlib inline
%config InlineBackend.figure_format='retina'
Code
# Download some MNIST to demonstrate…

Jul 12, 2023
Nipun Batra
1 min

Trees using NetworkX

ML
Code
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

%matplotlib inline

# Retina display
%config InlineBackend.figure_format =…
Jun 12, 2023
Nipun Batra
1 min

Positional Encoding

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd

dist =torch.distributions

sns.reset_defaults()
sns.set_co…

Jun 9, 2023
Nipun Batra
1 min

Bayesian Active Learning with Disagreement (BALD)

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd

dist =torch.distributions

sns.reset_defaults()
sns.set_co…
May 26, 2023
Nipun Batra
1 min

PINN

ML
PINNs are a class of neural networks for solving partial differential equations. They are trained to minimize the residual of the differential equation, and the boundary and…
May 5, 2023
Nipun Batra
1 min

Gradient wrt input for a simple model for adversarial attacks

ML
Main idea:
May 5, 2023
Nipun Batra
1 min

SIREN paper implementation

ML

Reconstruction from ReLU

Reconstruction from Sine
Apr 28, 2023
Nipun Batra
1 min

SIREN paper

ML
In this post, I’m noting some observations from the SIREN paper.
Apr 27, 2023
Nipun Batra
1 min

Heteroskedastic and Homoskedastic MLPs in PyTorch for regression

ML
Dataset
Apr 10, 2023
Nipun Batra
1 min

Tensorboard

ML
Code
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim

import numpy as np
import matplotlib.pyplot as plt

from torch.utils.da…
Mar 21, 2023
Nipun Batra
1 min

Residual Connections in PyTorch

ML
Code
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim

import numpy as np
import matplotlib.pyplot as plt

from torch.utils.da…
Mar 18, 2023
Nipun Batra
1 min

AutoML PyTorch

ML
automl
neural-architecture-search
hyperparameter-optimization
automated-machine-learning
pytorch
In this post, we look at AutoPyTorch, a framework for automated machine learning.
Feb 25, 2023
Nipun Batra
2 min
 

Stacking (Meta Learning)

ML
Feb 22, 2023
Nipun Batra
1 min

Stacking (Ensemble Learning)

ML
In this post, we study a simple meta learning technique called Stacking
Feb 21, 2023
Nipun Batra
1 min

Multivariate Taylor Series

ML
Second order Taylor series expansion of a function f around a point (x0, y0) is given by (when using the vector notation)
Feb 20, 2023
Nipun Batra
1 min

Comparing GP libraries

ML
In this notebook, we will show how to compare different GP libraries to give the same loss for a simple GP regression problem.
Feb 6, 2023
Nipun Batra
1 min

Understanding Singular Value Decomposition with Visualizations

ML
linear-algebra
matrix-decomposition
dimensionality-reduction
visualization
jax
Code
from jax import vmap, jit, grad, vmap
import jax.numpy as jnp

# Enable 64-bit mode
from jax.config import config
config.update("jax_enable_x64", True)
import matplotl…
Feb 1, 2023
Nipun Batra
1 min

Conformal Prediction

ML
This is a work in progress. I will be adding more content to this post in the coming days.
Jan 19, 2023
Nipun Batra
1 min
 

VSCode Settings and Tips

ML
vscode
Shortcut Action
Cmd + Shift + P Open command palette
Ctrl + ` Toggle terminal
Cmd + B Toggle sidebar
Cmd + Ctrl + F Toggle full screen
Jan 17, 2023
Nipun Batra
1 min

Binomial and Poisson distribution

ML
Code
import jax.numpy as jnp
import jax
from jax import random
import tensorflow_probability.substrates.jax as tfp
tfd = tfp.distributions
import pandas as pd

import matpl…
Nov 20, 2022
Nipun Batra
1 min
 

Some useful tidibts in sympy

ML

Some useful tidibts in sympy

Nov 9, 2022
Nipun Batra
1 min

Autoencoders in JAX

ML

A programming introduction to Autoencoders in JAX

Nov 4, 2022
Nipun Batra
1 min

Calibration

ml

Probability Calibration

Oct 27, 2022
Nipun Batra
1 min

Multi-output Gaussian Process

ml

Multi-output Gaussian Process

Oct 25, 2022
Nipun Batra
1 min

Welcome To My Blog

news
This is the first post in a Quarto blog. Welcome!
Sep 14, 2022
Tristan O’Malley
1 min

Audio Filtering

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
from functools import partial

sns.reset_defaults()
sns.set_context(context="ta…

Feb 24, 2022
Nipun Batra
1 min

Coordinate descent failure example

ML
Fix x2 = 2
Feb 21, 2022
Nipun Batra
1 min

Pyro Conditioning

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd
import pyro

dist =pyro.distributions

sns.reset_defaults()
…

Feb 20, 2022
Nipun Batra
1 min

Probabilstic PCA using PyTorch distributions

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd

dist =torch.distributions

sns.reset_defaults()
sns.set_co…
Feb 17, 2022
Nipun Batra
1 min

Linear Regression using Pyro

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd

t_dist =torch.distributions

sns.reset_defaults()
sns.set_…
Feb 17, 2022
Nipun Batra
1 min

Drawing graphical models

ML
References
Feb 15, 2022
Nipun Batra
1 min

Logistic Regression using PyTorch distributions

ML
Code
import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
import pandas as pd

dist =torch.distributions

sns.reset_defaults()
sns.set_co…
Feb 14, 2022
Nipun Batra
1 min

GMM

ML
mixture-models
clustering
expectation-maximization
probabilistic-models
unsupervised-learning
Code
import torch
dist = torch.distributions
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
%matplotlib inline
Feb 14, 2022
Nipun Batra
1 min

Variational inference

ML
variational-inference
bayesian
approximate-inference
probabilistic-models
optimization
Let us first look at G1. Look at the illustration below. We have a normal distribution \(p\) and two other normal distributions \(q_1\) and \(q_2\). Which of \(q_1\) and \(q_…
Feb 12, 2022
Nipun Batra
5 min

Matrix as transformation and interpreting low rank matrix

ML
LA
Multiplying a matrix A with a vector x transforms x
Feb 11, 2022
Nipun Batra
2 min

Maximum A-Posteriori (MAP) for parameters of univariate and multivariate normal distribution in PyTorch

ML
PyTorch
\(\hat{\theta}_{MAP}=\dfrac{n}{n+\sigma^{2}} \bar{x}+\dfrac{\sigma^{2}}{n+\sigma^{2}} \mu\)
Feb 11, 2022
Nipun Batra
1 min

Maximum Likelihood Estimation (MLE) for parameters of univariate and multivariate normal distribution in PyTorch

ML
PyTorch
Let us generate some normally distributed data and see if we can learn the mean.
Feb 9, 2022
Nipun Batra
1 min
 

Autograd in JAX and PyTorch

ML
JAX
PyTorch
Code
import torch
from jax import grad
import jax.numpy as jnp
Feb 9, 2022
Nipun Batra
1 min

Coin Toss (MLE, MAP, Fully Bayesian) in TF Probability

ML
TFP
TF
We will be studying the problem of coin tosses. I will not go into derivations but mostly deal with automatic gradient computation in TF Probability.
Feb 7, 2022
Nipun Batra
4 min

Simple Directed Graphical Models in TF Probability

ML
TFP
TF
References
Feb 5, 2022
Nipun Batra
1 min

Linear Regression in TF Probability using JointDistributionCoroutineAutoBatched

ML
TFP
TF
TODO
Feb 5, 2022
Nipun Batra
1 min

Sampling from univariate and multivariate normal distributions using Box-Muller transform

ML
In this notebook I’ll talk about sampling from univariate and multivariate normal distributions. I’ll mostly directly write the code and show the output. The excellent…
Feb 4, 2022
Nipun Batra
2 min

Understanding KL-Divergence

ML
Let us first look at G1. Look at the illustration below. We have a normal distribution \(p\) and two other normal distributions \(q_1\) and \(q_2\). Which of \(q_1\) and \(q_…
Jan 29, 2022
Nipun Batra
5 min

Linear Regression in Tensorflow Probability

ML
Good reference https://tensorchiefs.github.io/bbs/files/21052019-bbs-Beate-uncertainty.pdf
Jan 28, 2022
Nipun Batra
1 min

Testing out some distributions in Tensorflow Probability

ML
Let us generate some normally distributed data and see if we can learn the mean.
Jan 26, 2022
Nipun Batra
1 min

Learning Gaussian Process regression parameters using mini-batch stochastic gradient descent

ML

How to learn the parameters of a GP

Sep 3, 2021
Nipun Batra
3 min

Linear Regression from scratch in Julia

ML
Code
using Plots
theme(:default)

using LinearAlgebra
using LaTeXStrings
Sep 1, 2021
Nipun Batra
1 min

Probabilistic Programming in Pyro

ML
In this post, I will look at a simple application:
Aug 20, 2021
Nipun Batra
2 min

Blurring an image selectively using Affinity Photo

setup

Blurring an image selectively using Affinity Photo

Jun 19, 2021
1 min

Audio filters

signal-processing
audio
filtering
digital-signal-processing
python
scipy

Audio filtering techniques and applications

Jun 18, 2021
Nipun Batra
2 min

Running Python scripts on server over ssh and getting back content

setup
python
ssh
remote-development
networking
terminal

Running Python scripts on server over ssh and getting back content

Jun 17, 2021
2 min

Some of my shortcuts on the iPad

setup
ipad
shortcuts
automation
productivity
ios

Some of my shortcuts on the iPad

Jun 16, 2021
1 min

My iPad Setup

setup
ipad
mobile-development
productivity
ios

My iPad computing setup

Jun 14, 2021
10 min

My Mac Setup

setup
macos
development-environment
productivity
tools

My Mac Setup

Jun 12, 2021
Nipun Batra
6 min

GAN

ML
deep-learning
generative-models
adversarial-networks
neural-networks
keras
tensorflow

Implementation and visualization of Generative Adversarial Networks

May 31, 2021
Nipun Batra
4 min

Understanding Kernels in Gaussian Processes Regression

ML

Using GPy and some interactive visualisations for understanding GPR and applying on a real world data set

Jun 26, 2020
Nipun Batra
2 min

Sampling from common distributions

ML

From the ground up!

Apr 16, 2020
Nipun Batra
2 min

Learning Gaussian Process regression parameters using gradient descent

ML

How to learn the parameters of a GP

Mar 29, 2020
Nipun Batra
4 min

Active Learning with Bayesian Linear Regression

ML

A programming introduction to Active Learning with Bayesian Linear Regression.

Mar 28, 2020
Zeel Patel & Nipun Batra
8 min

Some experiments in Gaussian Processes Regression

ML

Using GPy and some interactive visualisations for understanding GPR and applying on a real world data set

Mar 26, 2020
Nipun Batra
5 min

Some Neural Network Classification

ML

A programming introduction to NNs.

Mar 8, 2020
Nipun Batra
1 min

Neural Networks from scratch

ML

Simple scripts for downloading weather data

Mar 2, 2020
Nipun Batra
1 min

Learning neural network for XOR

ML
Excellent, now let us start from random weight initialisations and use backprop to come to our result
Feb 28, 2020
Nipun Batra
1 min

Bayesian Linear Regression

ML
bayesian
linear-regression
uncertainty-quantification
probabilistic-models
statistics

A programming introduction to Bayesian Linear Regression.

Feb 20, 2020
Nipun Batra
1 min

An Example Markdown Post

markdown

A minimal example of using markdown with fastpages.

Jan 14, 2020
2 min

Gaussian Processes

ML
gaussian-processes
bayesian
uncertainty-quantification
probabilistic-models
kernel-methods

An interactive exploration of Gaussian processes.

Aug 20, 2019
Nipun Batra
16 min

Placement-Preparation-2018-1-HashMap

academia

HashMaps for programming interviews

Aug 18, 2018
Nipun Batra
2 min

Visualising Electricity Access Over Space and Time

sustainability

How is the world changing over the years!

Jun 26, 2018
Nipun Batra
2 min
 

Mapping location of air quality sensing in India

air quality

AQ sensing in India

Jun 21, 2018
Nipun Batra
1 min

Active Learning

ML

A programming introduction to query by committee strategy for active learning

Jun 16, 2018
Nipun Batra
2 min

Signal denoising using RNNs in PyTorch

ML

Denoising

Jan 13, 2018
Nipun Batra
3 min

CS Ph.D. lessons to my younger self

academia

Some personal reflections..

Jan 7, 2018
Nipun Batra
17 min

Neural Networks for Collaborative Filtering

ML

Neural networks to learn the embeddings! and how to combine them

Dec 29, 2017
Nipun Batra
3 min

Recommend keras

ML
recommendation-systems
collaborative-filtering
deep-learning
neural-networks
keras
tensorflow
I have written a few posts earlier about matrix factorisation using various Python libraries. The main application I had in mind for matrix factorisation was recommender…
Dec 18, 2017
Nipun Batra
6 min

Adagrad based matrix factorization

ML

Adagrad optimizer for matrix factorisation

Aug 13, 2017
Nipun Batra
1 min

Linear regression adagrad vs gd

ML
optimization
gradient-descent
adagrad
linear-regression
algorithms
In this post, I’ll be using Adagrad for solving linear regression. As usual, the purpose of this post is educational. This link gives a good overview of Adagrad alongwith…
Aug 12, 2017
Nipun Batra
4 min

Fifty ggplot python 1

visualization
data-visualization
ggplot
plotnine
python
data-analysis
A while back, I read this wonderful article called “Top 50 ggplot2 Visualizations - The Master List (With Full R Code)”. Many of the plots looked very useful. In this post…
Aug 2, 2017
Nipun Batra
2 min

Linear regression with prior (using gradient descent)

ML

What if we start from some prior!

Jun 15, 2017
Nipun Batra
1 min
 

Data exploration using widgets in Matplotlib

visualisation

Exploring data in Matplotlib

Jun 14, 2017
Nipun Batra
4 min
 

Constrained Non-negative matrix factorisation using CVXPY

ML

Constrained NMF using CVXPY!

Apr 21, 2017
Nipun Batra
2 min
 

Out of Tensor factorisation

ML

Out of tensor factorisation

Apr 20, 2017
Nipun Batra
3 min
 

Out of matrix non-negative matrix factorisation

ML

What if we to predict for entries not within the matrix?!

Apr 19, 2017
Nipun Batra
2 min

MCMC coins

ML
bayesian
mcmc
monte-carlo
probabilistic-models
parameter-estimation
In the previous post, I had discussed regarding the EM algorithm from a programmer’s perspective. That blog post sparked an interesting discussion on Twitter which has led…
Jul 1, 2014
Nipun Batra
3 min

Latexify Matplotlib

visualisation

Towards amazing plots in research papers!

Jun 2, 2014
Nipun Batra
2 min

Programatically understanding Expectation Maximization

ML

Maximize based on what you know, re-estimate!

Jun 1, 2014
Nipun Batra
6 min

Gibbs sampling

ML
bayesian
mcmc
gibbs-sampling
probabilistic-models
sampling-methods
Removing first 10% samples
May 1, 2014
Nipun Batra
1 min

DTW

ML
time-series
dynamic-time-warping
sequence-alignment
algorithms
distance-metrics
So you just recorded yourself saying a word and try to match it against another instance. The signals look similar, but have varying lengths and different activations for…
May 1, 2014
Nipun Batra
5 min

Denoising

ML
signal-processing
denoising
image-processing
feature-extraction
I took the Linear and Integer Programming course on coursera last year. It was a very well paced and structured course. In one of the modules, the instructors discussed…
Sep 1, 2013
Nipun Batra
3 min

HMM Simulation for Continuous HMM

ML

Simulating a continuous HMM

Jul 1, 2013
Nipun Batra
3 min

HMM simulate

ML
hidden-markov-models
sequence-modeling
probabilistic-models
time-series
simulation
In this notebook we shall create a Hidden Markov Model [1] for the Unfair Casino problem [2]. In short the problem is as follows: In a casino there may be two die- one fair…
Jun 1, 2013
Nipun Batra
4 min

Aggregation timeseries

time-series
data-aggregation
data-analysis
pandas
visualization
We’ve all grown up studying groupy by and aggregations in SQL. Pandas provides excellent functionality for group by and aggregations. However, for time series data, we need…
May 1, 2013
Nipun Batra
1 min

Downloading weather data

visualisation

Simple scripts for downloading weather data

Apr 1, 2013
Nipun Batra
1 min
No matching items
    Source Code
    ---
    title: "Writing"
    subtitle: "Notes on machine learning, VLMs, and building things."
    listing:
      contents: posts
      sort: "date desc"
      type: default
      categories: true
      sort-ui: false
      filter-ui: false
      fields: [image, date, title, description, categories, author, reading-time]
    page-layout: full
    ---
    

    © Nipun Batra