Quiz 2

Randomized Regression

102 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Randomized Regression ## 7.1 Leverage Score Sampling **Leverage score:** $h_{ii} = \mathbf{x}_i^T(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{x}_i$ Higher leverage = more influential point. Sample rows proportional to leverage for a fast, accurate regression.

Randomized Regression

7.1 Leverage Score Sampling

Leverage score: hii=xiT(XTX)1xih_{ii} = \mathbf{x}_i^T(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{x}_i Higher leverage = more influential point. Sample rows proportional to leverage for a fast, accurate regression.
python
import numpy as np
def leverage_score_sampling(X, y, k):
    n, p = X.shape
    U, _, _ = np.linalg.svd(X, full_matrices=False)
    leverage = np.sum(U**2, axis=1)
    prob = leverage / np.sum(leverage)
    idx = np.random.choice(n, size=k, replace=False, p=prob)
    return X[idx], y[idx]

7.2 Sketched Regression

Use random projection to reduce nn before regression:
minSAβSb22\min ||\mathbf{SA}\beta - \mathbf{Sb}||_2^2
Where S\mathbf{S} is a random sketching matrix (count-sketch, Gaussian, or Hadamard). Join Discord PreviousMinHash, SimHash, BloomNextMatrix Sketching
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.