LinearSvc
LinearSVC — linear Support Vector Machine for classification via dual coordinate descent. / LinearSVC — Machine à vecteurs de support linéaire pour classification.
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
svc = sp.LinearSVC(C=1.0)
svc.fit(X, y)
print(svc.score(X, y))
sp.LinearSvc has the same API as sklearn.FR — Remplacement direct : même API que sklearn, changez l'import.
API Reference
ml_linear_svc — aliases: linear_svc
sp.LinearSvc(C=1.0, max_iter=1000, tol=1e-4)
| Parameter | Type | Default | Description |
|---|---|---|---|
C | float | 1.0 | Regularisation parameter (inverse margin). |
max_iter | int | 1000 | Maximum iterations. |
tol | float | 1e-4 | Convergence tolerance. |
JSON with predictions.
$$\min_{w,b}\frac{1}{2}|w|^2 + C\sum_i \max(0, 1 - y_i(w^Tx_i + b))$$
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
svc = sp.LinearSVC(C=1.0)
svc.fit(X, y)
print(svc.score(X, y))
Référence API
ml_linear_svc — alias : linear_svc
sp.LinearSvc(C=1.0, max_iter=1000, tol=1e-4)
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
C | float | 1.0 | Paramètre de régularisation (inverse de la marge). |
max_iter | int | 1000 | Nombre maximum d'itérations. |
tol | float | 1e-4 | Tolérance de convergence. |
JSON avec predictions.
$$\min_{w,b}\frac{1}{2}|w|^2 + C\sum_i \max(0, 1 - y_i(w^Tx_i + b))$$
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
svc = sp.LinearSVC(C=1.0)
svc.fit(X, y)
print(svc.score(X, y))
LinearSvr
LinearSVR — epsilon-insensitive linear Support Vector Regression. / LinearSVR — régression linéaire par vecteurs de support avec perte epsilon-insensible.
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] * 2 - X[:, 2] + np.random.randn(400) * 0.5
svr = sp.LinearSVR(C=1.0, epsilon=0.1)
svr.fit(X, y)
print(svr.score(X, y))
sp.LinearSvr has the same API as sklearn.FR — Remplacement direct : même API que sklearn, changez l'import.
API Reference
ml_linear_svr — aliases: linear_svr
sp.LinearSvr(C=1.0, epsilon=0.1, max_iter=1000, tol=1e-4)
| Parameter | Type | Default | Description |
|---|---|---|---|
C | float | 1.0 | Regularisation parameter. |
epsilon | float | 0.1 | Epsilon-tube width. |
max_iter | int | 1000 | Maximum iterations. |
tol | float | 1e-4 | Convergence tolerance. |
JSON with predictions.
$$\min_{w,b}\frac{1}{2}|w|^2 + C\sum_i \max(0, |y_i - (w^Tx_i+b)| - \varepsilon)$$
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] * 2 - X[:, 2] + np.random.randn(400) * 0.5
svr = sp.LinearSVR(C=1.0, epsilon=0.1)
svr.fit(X, y)
print(svr.score(X, y))
Référence API
ml_linear_svr — alias : linear_svr
sp.LinearSvr(C=1.0, epsilon=0.1, max_iter=1000, tol=1e-4)
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
C | float | 1.0 | Paramètre de régularisation. |
epsilon | float | 0.1 | Largeur du tube epsilon. |
max_iter | int | 1000 | Nombre maximum d'itérations. |
tol | float | 1e-4 | Tolérance de convergence. |
JSON avec predictions.
$$\min_{w,b}\frac{1}{2}|w|^2 + C\sum_i \max(0, |y_i - (w^Tx_i+b)| - \varepsilon)$$
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] * 2 - X[:, 2] + np.random.randn(400) * 0.5
svr = sp.LinearSVR(C=1.0, epsilon=0.1)
svr.fit(X, y)
print(svr.score(X, y))