ModelSVR (Linear)
Epsilon (Tube Width)±1.5
Support Vectors
2
Epsilon Tube (Safe Zone)

Fitting a "Tube"

Standard Regression tries to hit EVERY point (using Mean Squared Error). SVR (Support Vector Regression) is smarter. It tries to fit a 'Tube' (Safety Zone) that contains as many points as possible.
Continue

1. The Epsilon Tube (Lane Width)

We define a 'Safe Zone' of width ε (Epsilon). Any point inside this zone is considered 'Good Enough' (Zero Error). We essentially say: 'If you are within 5 meters of the center, you are perfect.'
Continue

2. Adjusting the Road Width (ε)

• Large Epsilon = Wide 8-Lane Highway. Fits loosely, ignores small bumps (Robust). • Small Epsilon = Narrow Bike Path. Must wiggle frantically to fit everyone (Overfitting).
Continue

3. The "Guardrails" (Support Vectors)

So what defines the road? Only the points hitting the guardrails or lying outside! These are the 'Support Vectors'. Points comfortably in the middle don't matter anymore. This makes SVR distinct from other algorithms.
Continue

Interactive Engineer

1. Drag 'Epsilon' to widen the road. Watch points turn white (Inside) vs Red (Guardrails). 2. Switch to 'RBF Kernel' to let the road curve!
Continue

Coding SVR

Using `epsilon` to control tolerance and `kernel` for flexibility.

svr_model.py
from sklearn.svm import SVR

# 1. Create Model
# kernel='linear' for lines
# kernel='rbf' for curves
# epsilon=0.1 means "ignore errors smaller than 0.1"
model = SVR(kernel='rbf', C=100, epsilon=0.1)

# 2. Train
model.fit(X, y)

# 3. Predict
print(model.predict([[5.0]]))

# 4. View Support Vectors
print(f"Num Support Vectors: {len(model.support_)}")
# We want this number to be small!
Using Scikit-Learn SVR
AlgoAnimator: Interactive Data Structures