The Perceptron

Life is a continuous learning process.

Take in every experience. Give weight to what helps you grow. Learn from what causes loss. Adjust, try again, and move forward.

You don't need to begin with the right weights. You just need to keep learning.

Learning machines. Learning mathematics. Learning how to learn.

Math: Learn to Read It, Not Fear It

In Machine Learning, equations are easier when you stop looking at them as complicated math and start reading them like sentences.

Think of it this way:
Symbols are just words.
An equation is just a sentence made from those words.

Start With the Most Common Symbols

Symbols That Tell Us What to Do

Small Symbols Around Other Symbols

Now Read an Equation Like a Sentence

Suppose you see:

ลท = wx + b

Don't immediately think, "Oh no, math."

Translate each symbol:

So the equation is simply saying:

"Take the input, multiply it by its importance, add an adjustment, and you get the model's prediction."

A More Machine-Learning-Looking Equation

You may eventually see something like:

ฮธ := ฮธ โˆ’ ฮฑโˆ‡J(ฮธ)

Instead of memorizing it, translate it:

In normal English:

"Change the model's settings a little bit in the direction that reduces its error."

That is the basic idea behind gradient descent.

The Main Idea

You do not need to memorize every mathematical symbol immediately. When you see an ML equation:

  1. Identify what each symbol means.
  2. Figure out what operation is happening.
  3. Translate the equation into normal English.
  4. Only then worry about the formal mathematics.

Once you can translate the symbols, an equation stops looking like:

"ฮธ, ฮฑ, โˆ‡, ฮฃ ... what is going on?"

and starts sounding like:

"Make a prediction, compare it with the real answer, measure the error, and adjust the model so the next prediction is better."

Python Fundamentals

These are the Python concepts that show up constantly in AI, ML, and DL work โ€” and just as importantly, the ones you should be comfortable explaining during a technical interview.

The goal is not to memorize syntax. The goal is to understand what the code is doing well enough that you can explain it, modify it, debug it, and write a small version of it under pressure.

Interview mindset:

For every concept below, ask yourself three questions: What does it do? Why would I use it? What happens if I change it?

Lists & list comprehensions

Lists store ordered collections of values. In ML code, they appear in preprocessing, filtering, batching, feature construction, and quick data transformations.

Interview check:Be able to convert a normal loop into a list comprehension and explain when readability is more important than making the code shorter.

squares = [x**2 for x in range(5)]
  
  # Same idea written normally:
  squares = []
  
  for x in range(5):
      squares.append(x**2)
Dictionaries

Dictionaries store information as key-value pairs. They are everywhere in ML projects: configurations, label mappings, model outputs, hyperparameters, and experiment results.

Interview check:Know how to access, update, loop through, and safely retrieve dictionary values using .get().

config = {
      "lr": 0.001,
      "epochs": 10
  }
  
  print(config["lr"])
  
  config["epochs"] = 20
  
  batch_size = config.get("batch_size", 32)
Tuples & unpacking

Tuples often represent fixed groups of values. Unpacking lets you pull those values apart cleanly.

Interview check:Understand whybatch_size, channels, height, width = x.shapeis useful and what error occurs if the number of values does not match.

shape = (32, 3, 224, 224)
  
  batch_size, channels, h, w = shape
  
  print(batch_size)
  # 32
Functions & default arguments

Functions organize reusable logic. Training loops, preprocessing steps, evaluation functions, and model utilities are usually built from small reusable functions.

Interview check:Be able to explain parameters, return values, default arguments, and why mutable default arguments can be dangerous.

def train(model, epochs=10, lr=0.001):
      print(f"Training for {epochs} epochs")
      print(f"Learning rate: {lr}")
*args and **kwargs

*args collects extra positional arguments.**kwargs collects extra named arguments.

Interview check:Be able to explain the difference between positional arguments and keyword arguments.

def example(*args, **kwargs):
      print(args)
      print(kwargs)
  
  example(1, 2, lr=0.001, epochs=10)
Classes & __init__

Classes let us group data and behavior together. In deep learning, models are usually represented as objects.

Interview check:Be able to explain what self, __init__, inheritance, and super() are doing.

class Net(nn.Module):
  
      def __init__(self):
          super().__init__()
          self.fc = nn.Linear(10, 1)
  
      def forward(self, x):
          return self.fc(x)
Loops with enumerate()

enumerate() gives you both the position and the value while looping.

Interview check:Know why enumerate() is usually cleaner than manually maintaining a counter.

losses = [0.9, 0.6, 0.3]
  
  for epoch, loss in enumerate(losses):
      print(epoch, loss)
zip()

zip() lets you loop through multiple collections together.

Interview check:Know what happens if the collections have different lengths.

predictions = [1, 0, 1]
  labels = [1, 1, 1]
  
  for pred, label in zip(predictions, labels):
      print(pred, label)
Lambda functions

Lambda functions are small anonymous functions used when a full function definition would be unnecessary.

Interview check:Know the syntax, but also know when a normal function would be more readable.

numbers = [1, 2, 3, 4]
  
  squares = list(map(lambda x: x**2, numbers))
Exception handling

Real ML pipelines fail: missing files, invalid inputs, corrupt samples, bad API responses, and shape mismatches all happen.

Interview check:Understand try, except, and why catching every error with a bare except is usually a bad idea.

try:
      value = int(user_input)
  
  except ValueError:
      print("Input must be a number.")
Decorators

Decorators modify the behavior of a function without changing the function itself.

Interview check:You do not always need to implement a decorator from scratch, but you should understand what the @ syntax means.

@torch.no_grad()
  def evaluate(model, x):
      return model(x)
Iterators & generators

Generators produce values one at a time instead of storing everything in memory at once.

Interview check:Be able to explain why yield can use less memory than returning one huge list.

def batches(data, batch_size):
  
      for i in range(0, len(data), batch_size):
          yield data[i:i + batch_size]

Python Interview Questions You Should Be Able to Answer

  • What is the difference between a list and a tuple?
  • What is the difference between == and is?
  • What is the difference between a shallow copy and a deep copy?
  • What are mutable and immutable objects?
  • What do *args and **kwargs do?
  • What does self mean inside a Python class?
  • What does super() do?
  • What is a generator and why would you use one?
  • What is the difference between append() and extend()?
  • What happens when you assign one list to another variable?
  • What is a dictionary lookup and why is it usually fast?
  • What is the difference between range() and a list?
  • What does a decorator do?
  • Why are exceptions useful?
  • What is the difference between a method and a function?

The Standard You Want

You are interview-ready when you can do more than recognize the syntax.

You should be able to look at a short piece of Python code and:

Syntax gets you through the code. Understanding gets you through the interview.

PYTHON TOOLBOX

Python Libraries

Same data. Different tools. Choose a library and see exactly what role it plays in the machine-learning workflow.

1

DataLoad & clean

โ†’
2

PrepareArrays

โ†’
3

ModelLearn

โ†’
4

VisualizeUnderstand

โ–ค
titanic.csv891 rows ร— 12 columns
โ†’
pandas DataFramepandas
nameagesexsurvived
Braund22male0
Cumings38female1
HeikkinenNaNfemale1
Futrelle35female0
Allen4male1

pandas turns raw tabular data into a structured DataFrame that is easy to inspect and clean.

When should I use each one?

โ–ฆ
pandas

CSV, Excel & tabular data

โ—‡
NumPy

Fast numerical operations

โŒ˜
scikit-learn

Regression & classification

โ—‰
PyTorch

Building neural networks

โ–ฅ
Matplotlib

Visualizing data & results

ML Fundamentals

A week-by-week series โ€” starting from the unglamorous but essential work of cleaning data, then building up through classical models, feature engineering, and optimization.

Explore the ML learning map โ†’

Deep Learning

A 14-week series โ€” starting from the bridge between classical ML and neural networks, then building up through architectures, training techniques, generative models, and reinforcement learning.

Explore the DL learning map โ†’

SQL

Most real-world data starts in a database. Being able to pull exactly what you need with SQL is often the first step before any ML work even begins.

Interview mindset:

For every query: What table(s) do I need? What am I filtering, grouping, or joining? What would break if there are duplicates or NULLs?

SELECT & WHERE

The basic building blocks โ€” choosing columns and filtering rows.

Interview check:Know the difference between filtering with WHERE(before grouping) and HAVING (after grouping).

SELECT name, age
  FROM users
  WHERE age > 25;
JOINs

Combine rows from two or more tables based on a related column.

Interview check:Know the difference between INNER, LEFT, and RIGHT joins โ€” and what happens to unmatched rows in each.

SELECT orders.id, users.name
  FROM orders
  LEFT JOIN users
    ON orders.user_id = users.id;
GROUP BY & Aggregations

Groups rows sharing a value and computes something across each group โ€” counts, sums, averages.

Interview check:Know why every non-aggregated column in SELECT must appear in GROUP BY.

SELECT department, AVG(salary)
  FROM employees
  GROUP BY department;
Subqueries

A query nested inside another โ€” useful for filtering based on a computed value.

Interview check:Know when a subquery could be rewritten as a JOIN, and why that might be more efficient.

SELECT name FROM users
  WHERE id IN (
    SELECT user_id FROM orders
    WHERE total > 100
  );
Indexes

A data structure that speeds up lookups on a column, at the cost of extra storage and slower writes.

Interview check:Explain why indexes speed up reads but can slow down inserts/updates.

CREATE INDEX idx_user_id
  ON orders (user_id);

SQL Interview Questions You Should Be Able to Answer

  • What is the difference between WHERE and HAVING?
  • What is the difference between INNER JOIN and LEFT JOIN?
  • What does GROUP BY actually do?
  • When would you use a subquery instead of a JOIN?
  • What is an index, and what's the tradeoff of using one?
  • What is the difference between COUNT(*) and COUNT(column)?

The Standard You Want

You should be able to write a query from a plain-English question without hesitating, and explain what happens to your result if the data has duplicates or missing values.

A working query isn't enough โ€” know why it returns exactly what it does.

ROS (Robot Operating System)

ROS is the standard middleware for robotics โ€” it doesn't run robots directly, but provides the communication framework that lets different parts of a robotic system talk to each other.

Interview mindset:

For every ROS setup: What nodes exist? What topics are they publishing or subscribing to? What message type is flowing between them?

Nodes

A node is a single process performing one job โ€” reading a sensor, running a controller, processing an image.

Interview check:Know why splitting a robot's software into many small nodes is preferred over one giant program.

rosrun my_package my_node.py
Topics & Pub/Sub

Nodes communicate by publishing messages to topics, and other nodes subscribe to receive them โ€” a decoupled, many-to-many communication pattern.

Interview check:Know that a publisher doesn't need to know who (or how many) is subscribing.

pub = rospy.Publisher('velocity', Twist, queue_size=10)
  pub.publish(msg)
  
  rospy.Subscriber('velocity', Twist, callback)
Messages

Strictly typed data structures passed between nodes โ€” like a schema for what a topic is allowed to carry.

Interview check:Know that a publisher and subscriber must agree on the exact message type to communicate.

from geometry_msgs.msg import Twist
  
  msg = Twist()
  msg.linear.x = 1.0
Launch Files

A single file that starts multiple nodes together with their configuration, instead of running each manually.

Interview check:Know why launch files matter once a system has more than a couple of nodes.

<launch>
    <node pkg="my_package" type="my_node.py" name="my_node" />
  </launch>

ROS Interview Questions You Should Be Able to Answer

  • What is a ROS node?
  • How does the publish/subscribe model work?
  • What is a message, and why does it need a fixed type?
  • What's the benefit of splitting robot software into multiple nodes?
  • What is a launch file used for?

The Standard You Want

You should be able to sketch out a basic node graph for a simple robot task โ€” what nodes exist, what topics connect them, and what data flows where.

ROS is about communication design as much as it is about robotics.

CUDA

CUDA is what lets PyTorch (and other frameworks) run computations on an NVIDIA GPU instead of the CPU โ€” often 10-100x faster for the matrix math deep learning relies on.

Interview mindset:

For every operation: Is this running on the CPU or GPU? Do the tensors involved actually live on the same device?

Checking for GPU Availability

Always check if a GPU is actually available before assuming your code will use one โ€” code should gracefully fall back to CPU.

Interview check:Know why hardcoding "cuda" without checking availability will crash on a CPU-only machine.

import torch
  
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Moving Tensors & Models to GPU

Both your model and your data need to be on the same device โ€” a common source of runtime errors is mismatched devices.

Interview check:Know the exact error PyTorch throws when tensors are on different devices.

model = model.to(device)
  x = x.to(device)
  
  output = model(x)
GPU Memory

GPU memory (VRAM) is limited and separate from system RAM. Large batch sizes or models can run out of it.

Interview check:Know that reducing batch size is the most common fix for a CUDA out-of-memory error.

torch.cuda.memory_allocated()
  torch.cuda.empty_cache()
Mixed Precision Training

Uses lower-precision (16-bit) floats for parts of training to speed things up and use less memory, without meaningfully hurting accuracy.

Interview check:Know the basic tradeoff โ€” faster and more memory-efficient, at the cost of some numerical precision.

scaler = torch.cuda.amp.GradScaler()
  
  with torch.cuda.amp.autocast():
      output = model(x)
      loss = loss_fn(output, y)

CUDA Interview Questions You Should Be Able to Answer

  • Why is training on a GPU faster than on a CPU?
  • What happens if your model and data are on different devices?
  • What causes a CUDA out-of-memory error, and how would you fix it?
  • What is mixed precision training, and what's the tradeoff?

The Standard You Want

You should be comfortable debugging a device-mismatch error immediately, and know what to try first when you hit an out-of-memory error mid-training.

A GPU only helps if your code is actually using it correctly.

Simulation Environments

Before deploying to real hardware, robotics and RL models are usually trained and tested in simulation โ€” faster, safer, and far cheaper than breaking real robots.

Interview mindset:

For every simulator: What's being modeled physically? How well does simulated behavior transfer to the real world?

MuJoCo

A physics engine (Multi-Joint dynamics with Contact) built for fast, accurate simulation of contact-rich robotics tasks.

Interview check:Know that MuJoCo models are typically defined declaratively in XML, describing bodies and joints rather than coding them.

import mujoco
  
  mujoco.mj_step(model, data)
NVIDIA Isaac Sim

A GPU-accelerated simulation platform that can run thousands of environments in parallel โ€” built specifically for training RL policies at scale.

Interview check:Know why massive parallelism matters specifically for RL (which needs huge amounts of experience to train well).

# Conceptual โ€” thousands of environments
  # stepped together on GPU
  envs = IsaacEnv(num_envs=4096)
  obs = envs.reset()
Domain Randomization

Randomizing simulation parameters (friction, lighting, mass) during training so a policy generalizes better to the real world.

Interview check:Know why this directly addresses the "sim-to-real gap."

# Conceptual
  env.randomize_physics(friction_range=(0.5, 1.5))
Sim-to-Real Transfer

Taking a policy trained entirely in simulation and deploying it on physical hardware โ€” rarely a perfect 1:1 match.

Interview check:Name at least one technique used to close the sim-to-real gap (domain randomization, fine-tuning on real data).

policy.load("trained_in_sim.pt")
  real_robot.run(policy)

Simulation Interview Questions You Should Be Able to Answer

  • Why use a physics simulator instead of testing directly on real hardware?
  • What's the difference between MuJoCo and Isaac Sim in terms of scale?
  • What is domain randomization, and what problem does it solve?
  • What is the "sim-to-real gap"?

The Standard You Want

You should understand simulation not just as a testing tool, but as a way to generate cheap, safe training data at a scale real hardware can't match.

Simulation scale is often the difference between an RL policy that works and one that doesn't.