Machine Learning Handbook — From Zero to Hero

By Vaibhav Gupta | July 14, 2026 | Free Resource

Table of Contents

1. Supervised Learning

Linear Regression

from sklearn.linear_model import LinearRegression
import numpy as np

# Sample data
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2, 4, 5, 4, 5])

# Train model
model = LinearRegression()
model.fit(X, y)

# Predict
prediction = model.predict([[6]])
print(prediction)  # [5.8]

Decision Trees

from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import load_iris

# Load data
iris = load_iris()
X, y = iris.data, iris.target

# Train model
model = DecisionTreeClassifier()
model.fit(X, y)

# Predict
prediction = model.predict([[5.1, 3.5, 1.4, 0.2]])
print(prediction)  # [0]

2. Unsupervised Learning

K-Means Clustering

from sklearn.cluster import KMeans
import numpy as np

# Sample data
X = np.array([[1, 2], [1, 4], [1, 0],
              [10, 2], [10, 4], [10, 0]])

# Train model
kmeans = KMeans(n_clusters=2)
kmeans.fit(X)

# Predict
labels = kmeans.labels_
print(labels)  # [0, 0, 0, 1, 1, 1]

3. Deep Learning

Neural Network with TensorFlow

import tensorflow as tf
from tensorflow import keras

# Build model
model = keras.Sequential([
    keras.layers.Dense(64, activation='relu', input_shape=(10,)),
    keras.layers.Dense(32, activation='relu'),
    keras.layers.Dense(1, activation='sigmoid')
])

# Compile model
model.compile(optimizer='adam',
              loss='binary_crossentropy',
              metrics=['accuracy'])

# Train model
model.fit(X_train, y_train, epochs=10, batch_size=32)

4. Model Evaluation

from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score

# Metrics
accuracy = accuracy_score(y_true, y_pred)
precision = precision_score(y_true, y_pred)
recall = recall_score(y_true, y_pred)
f1 = f1_score(y_true, y_pred)

print(f"Accuracy: {accuracy}")
print(f"Precision: {precision}")
print(f"Recall: {recall}")
print(f"F1 Score: {f1}")

5. ML Projects for Resume

House Price Prediction

Regression model with feature engineering

Customer Churn Prediction

Classification with imbalanced data

Sentiment Analysis

NLP model for text classification

Image Classification

CNN model for image recognition

Download ML Handbook PDF

Get the complete ML Handbook as a free PDF. Enter your email to receive the download link.

Start Learning with DSWallah

Join 300+ students who transformed their careers with DSWallah. IIT-certified mentor, 50+ real projects, placement support.

WhatsApp for Free Demo →