Solved Numerical Examples
Work through complete, step-by-step manual calculations and algorithm traces. Each example details every intermediate formula, table update, and decision step so you can verify your math by hand.
Machine Learning
Worked mathematical solutions for classification, regression, clustering, and evaluation metrics, detailing step-by-step calculations and intermediate formulas.
Naive Bayes Classifier
Calculates prior and conditional probabilities step-by-step to predict a class label using Bayes' Theorem.
Confusion Matrix & Evaluation Metrics
Derives Accuracy, Precision, Recall, and F1 Score from a 2×2 matrix of TP, TN, FP, and FN counts.
Decision Tree (ID3)
Calculates Entropy and Information Gain for each feature to determine the optimal recursive splits.
K-Means Clustering
Iteratively assigns points to nearest centroids and recomputes centroid means until cluster assignments converge.
K-Nearest Neighbors (Classification)
Computes Euclidean distances from a query point to all training points, then votes among K nearest neighbors.
K-Nearest Neighbors Regression
Computes Euclidean distances from a query point to all training points, then averages the K nearest target values.
Linear Regression
Derives the slope and intercept using the least squares formula, then predicts a continuous target value.
Multiple Linear Regression
Solves the Normal Equation β = (XᵀX)⁻¹Xᵀy using matrix operations to find all feature coefficients simultaneously.
Random Forest Classifier
Runs ID3 on three bootstrap samples with restricted feature subsets, then aggregates predictions by majority vote.
Graph Search
Complete manual graph and tree traces comparing queue, stack, cost, and heuristic node expansions for uninformed and informed algorithms.
A* Search Algorithm
Expands nodes by f(n)=g(n)+h(n), tracking an open list and closed list to find the guaranteed optimal path.
Breadth-First Search (BFS)
Explores a graph level by level using a FIFO queue, guaranteeing the shallowest path to the goal node.
Depth-First Search (DFS)
Explores a graph by committing fully to each path using a LIFO stack, backtracking only on dead ends.
Uniform Cost Search (Dijkstra's Algorithm)
Expands nodes in strict order of cumulative path cost using a priority queue, guaranteeing the cheapest route to the goal.
Greedy Best-First Search
Expands the node with the lowest heuristic h(n) at every step, ignoring cumulative path cost entirely.
Game Trees & Adversarial Search
Step-by-step game tree evaluations illustrating minimax value propagation, alternating MAX/MIN layers, and alpha-beta pruning cutoffs.
Optimization & Evolutionary
Iterative calculations for association rule mining and genetic algorithms, demonstrating itemset generation, crossover, mutation, and constraint checks.
Apriori Algorithm
Generates frequent itemsets pass-by-pass using minimum support pruning, then derives association rules above minimum confidence.
Genetic Algorithm (One-Max)
Runs selection, single-point crossover, and mutation across generations to evolve binary strings toward all 1s.
Genetic Algorithm (Knapsack)
Evolves binary chromosomes encoding item selections, applying fitness penalties when weight capacity is exceeded.
Need a worked example for another problem? Request an example