or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

advanced.mdclustering.mddaal4py-mb.mddecomposition.mdensemble.mdindex.mdlinear-models.mdmetrics-model-selection.mdneighbors.mdpatching-config.mdstats-manifold.mdsvm.md

svm.mddocs/

0

# Support Vector Machines

1

2

High-performance implementations of Support Vector Machine algorithms with Intel hardware acceleration. These algorithms provide significant speedups for classification and regression tasks using optimized kernel computations and solver algorithms.

3

4

## Capabilities

5

6

### Support Vector Classifier (SVC)

7

8

Intel-accelerated Support Vector Classifier with optimized kernel computations and SMO solver.

9

10

```python { .api }

11

class SVC:

12

"""

13

Support Vector Classifier with Intel optimization.

14

15

Provides significant speedup over standard scikit-learn implementation

16

through optimized kernel computations and accelerated SMO solver.

17

"""

18

19

def __init__(

20

self,

21

C=1.0,

22

kernel='rbf',

23

degree=3,

24

gamma='scale',

25

coef0=0.0,

26

shrinking=True,

27

probability=False,

28

tol=1e-3,

29

cache_size=200,

30

class_weight=None,

31

verbose=False,

32

max_iter=-1,

33

decision_function_shape='ovr',

34

break_ties=False,

35

random_state=None

36

):

37

"""

38

Initialize Support Vector Classifier.

39

40

Parameters:

41

C (float): Regularization parameter

42

kernel (str): Kernel type ('linear', 'poly', 'rbf', 'sigmoid', 'precomputed')

43

degree (int): Degree for poly kernel

44

gamma (str or float): Kernel coefficient ('scale', 'auto', or float)

45

coef0 (float): Independent term for poly/sigmoid kernels

46

shrinking (bool): Whether to use shrinking heuristic

47

probability (bool): Whether to enable probability estimates

48

tol (float): Tolerance for stopping criterion

49

cache_size (float): Size of kernel cache (MB)

50

class_weight (dict or str): Class weights ('balanced' or dict)

51

verbose (bool): Enable verbose output

52

max_iter (int): Hard limit on iterations (-1 for no limit)

53

decision_function_shape (str): Shape of decision function ('ovo', 'ovr')

54

break_ties (bool): Break ties according to confidence values

55

random_state (int): Random state for reproducibility

56

"""

57

58

def fit(self, X, y, sample_weight=None):

59

"""

60

Fit the SVM model according to training data.

61

62

Parameters:

63

X (array-like): Training vectors of shape (n_samples, n_features)

64

y (array-like): Target values of shape (n_samples,)

65

sample_weight (array-like): Per-sample weights

66

67

Returns:

68

self: Fitted estimator

69

"""

70

71

def predict(self, X):

72

"""

73

Perform classification on samples in X.

74

75

Parameters:

76

X (array-like): Samples of shape (n_samples, n_features)

77

78

Returns:

79

array: Class labels for samples

80

"""

81

82

def predict_proba(self, X):

83

"""

84

Compute probabilities of possible outcomes for samples in X.

85

86

Only available when probability=True.

87

88

Parameters:

89

X (array-like): Samples

90

91

Returns:

92

array: Probability estimates of shape (n_samples, n_classes)

93

"""

94

95

def predict_log_proba(self, X):

96

"""

97

Compute log probabilities of possible outcomes for samples in X.

98

99

Only available when probability=True.

100

101

Parameters:

102

X (array-like): Samples

103

104

Returns:

105

array: Log probability estimates

106

"""

107

108

def decision_function(self, X):

109

"""

110

Evaluate decision function for samples in X.

111

112

Parameters:

113

X (array-like): Samples

114

115

Returns:

116

array: Decision function values

117

"""

118

119

def score(self, X, y, sample_weight=None):

120

"""

121

Return mean accuracy on given test data and labels.

122

123

Parameters:

124

X (array-like): Test samples

125

y (array-like): True labels

126

sample_weight (array-like): Sample weights

127

128

Returns:

129

float: Mean accuracy score

130

"""

131

132

# Attributes available after fitting

133

support_: ... # Indices of support vectors

134

support_vectors_: ... # Support vectors

135

n_support_: ... # Number of support vectors for each class

136

dual_coef_: ... # Coefficients of support vectors in decision function

137

coef_: ... # Weights assigned to features (linear kernel only)

138

intercept_: ... # Constants in decision function

139

classes_: ... # Class labels

140

gamma_: ... # Current gamma value

141

class_weight_: ... # Weights assigned to classes

142

shape_fit_: ... # Array dimensions of training vector X

143

n_features_in_: ... # Number of features seen during fit

144

```

145

146

### Support Vector Regressor (SVR)

147

148

Intel-accelerated Support Vector Regressor for continuous target prediction.

149

150

```python { .api }

151

class SVR:

152

"""

153

Support Vector Regressor with Intel optimization.

154

155

Efficient regression using support vector machines with optimized

156

kernel computations and accelerated solver algorithms.

157

"""

158

159

def __init__(

160

self,

161

kernel='rbf',

162

degree=3,

163

gamma='scale',

164

coef0=0.0,

165

tol=1e-3,

166

C=1.0,

167

epsilon=0.1,

168

shrinking=True,

169

cache_size=200,

170

verbose=False,

171

max_iter=-1

172

):

173

"""

174

Initialize Support Vector Regressor.

175

176

Parameters:

177

kernel (str): Kernel type ('linear', 'poly', 'rbf', 'sigmoid', 'precomputed')

178

degree (int): Degree for poly kernel

179

gamma (str or float): Kernel coefficient ('scale', 'auto', or float)

180

coef0 (float): Independent term for poly/sigmoid kernels

181

tol (float): Tolerance for stopping criterion

182

C (float): Regularization parameter

183

epsilon (float): Epsilon parameter in epsilon-SVR model

184

shrinking (bool): Whether to use shrinking heuristic

185

cache_size (float): Size of kernel cache (MB)

186

verbose (bool): Enable verbose output

187

max_iter (int): Hard limit on iterations (-1 for no limit)

188

"""

189

190

def fit(self, X, y, sample_weight=None):

191

"""

192

Fit the SVM model according to training data.

193

194

Parameters:

195

X (array-like): Training vectors of shape (n_samples, n_features)

196

y (array-like): Target values of shape (n_samples,)

197

sample_weight (array-like): Per-sample weights

198

199

Returns:

200

self: Fitted estimator

201

"""

202

203

def predict(self, X):

204

"""

205

Perform regression on samples in X.

206

207

Parameters:

208

X (array-like): Samples of shape (n_samples, n_features)

209

210

Returns:

211

array: Predicted values for samples

212

"""

213

214

def score(self, X, y, sample_weight=None):

215

"""

216

Return coefficient of determination R^2 of prediction.

217

218

Parameters:

219

X (array-like): Test samples

220

y (array-like): True values

221

sample_weight (array-like): Sample weights

222

223

Returns:

224

float: R^2 score

225

"""

226

227

# Attributes available after fitting

228

support_: ... # Indices of support vectors

229

support_vectors_: ... # Support vectors

230

dual_coef_: ... # Coefficients of support vectors in decision function

231

coef_: ... # Weights assigned to features (linear kernel only)

232

intercept_: ... # Constants in decision function

233

gamma_: ... # Current gamma value

234

shape_fit_: ... # Array dimensions of training vector X

235

n_features_in_: ... # Number of features seen during fit

236

```

237

238

### Nu Support Vector Classifier (NuSVC)

239

240

Intel-accelerated Nu Support Vector Classifier using nu-SVM formulation.

241

242

```python { .api }

243

class NuSVC:

244

"""

245

Nu Support Vector Classifier with Intel optimization.

246

247

Similar to SVC but uses nu parameter instead of C for controlling

248

the number of support vectors and training errors.

249

"""

250

251

def __init__(

252

self,

253

nu=0.5,

254

kernel='rbf',

255

degree=3,

256

gamma='scale',

257

coef0=0.0,

258

shrinking=True,

259

probability=False,

260

tol=1e-3,

261

cache_size=200,

262

class_weight=None,

263

verbose=False,

264

max_iter=-1,

265

decision_function_shape='ovr',

266

break_ties=False,

267

random_state=None

268

):

269

"""

270

Initialize Nu Support Vector Classifier.

271

272

Parameters:

273

nu (float): Upper bound on fraction of margin errors (0 < nu <= 1)

274

kernel (str): Kernel type ('linear', 'poly', 'rbf', 'sigmoid', 'precomputed')

275

degree (int): Degree for poly kernel

276

gamma (str or float): Kernel coefficient ('scale', 'auto', or float)

277

coef0 (float): Independent term for poly/sigmoid kernels

278

shrinking (bool): Whether to use shrinking heuristic

279

probability (bool): Whether to enable probability estimates

280

tol (float): Tolerance for stopping criterion

281

cache_size (float): Size of kernel cache (MB)

282

class_weight (dict or str): Class weights ('balanced' or dict)

283

verbose (bool): Enable verbose output

284

max_iter (int): Hard limit on iterations (-1 for no limit)

285

decision_function_shape (str): Shape of decision function ('ovo', 'ovr')

286

break_ties (bool): Break ties according to confidence values

287

random_state (int): Random state for reproducibility

288

"""

289

290

def fit(self, X, y, sample_weight=None):

291

"""

292

Fit the Nu-SVM model according to training data.

293

294

Parameters:

295

X (array-like): Training vectors of shape (n_samples, n_features)

296

y (array-like): Target values of shape (n_samples,)

297

sample_weight (array-like): Per-sample weights

298

299

Returns:

300

self: Fitted estimator

301

"""

302

303

def predict(self, X):

304

"""

305

Perform classification on samples in X.

306

307

Parameters:

308

X (array-like): Samples of shape (n_samples, n_features)

309

310

Returns:

311

array: Class labels for samples

312

"""

313

314

def predict_proba(self, X):

315

"""

316

Compute probabilities of possible outcomes for samples in X.

317

318

Only available when probability=True.

319

320

Parameters:

321

X (array-like): Samples

322

323

Returns:

324

array: Probability estimates of shape (n_samples, n_classes)

325

"""

326

327

def predict_log_proba(self, X):

328

"""

329

Compute log probabilities of possible outcomes for samples in X.

330

331

Only available when probability=True.

332

333

Parameters:

334

X (array-like): Samples

335

336

Returns:

337

array: Log probability estimates

338

"""

339

340

def decision_function(self, X):

341

"""

342

Evaluate decision function for samples in X.

343

344

Parameters:

345

X (array-like): Samples

346

347

Returns:

348

array: Decision function values

349

"""

350

351

def score(self, X, y, sample_weight=None):

352

"""

353

Return mean accuracy on given test data and labels.

354

355

Parameters:

356

X (array-like): Test samples

357

y (array-like): True labels

358

sample_weight (array-like): Sample weights

359

360

Returns:

361

float: Mean accuracy score

362

"""

363

364

# Attributes available after fitting

365

support_: ... # Indices of support vectors

366

support_vectors_: ... # Support vectors

367

n_support_: ... # Number of support vectors for each class

368

dual_coef_: ... # Coefficients of support vectors in decision function

369

coef_: ... # Weights assigned to features (linear kernel only)

370

intercept_: ... # Constants in decision function

371

classes_: ... # Class labels

372

gamma_: ... # Current gamma value

373

class_weight_: ... # Weights assigned to classes

374

shape_fit_: ... # Array dimensions of training vector X

375

n_features_in_: ... # Number of features seen during fit

376

```

377

378

### Nu Support Vector Regressor (NuSVR)

379

380

Intel-accelerated Nu Support Vector Regressor using nu-SVM formulation.

381

382

```python { .api }

383

class NuSVR:

384

"""

385

Nu Support Vector Regressor with Intel optimization.

386

387

Similar to SVR but uses nu parameter to control the number of

388

support vectors in the regression model.

389

"""

390

391

def __init__(

392

self,

393

nu=0.5,

394

C=1.0,

395

kernel='rbf',

396

degree=3,

397

gamma='scale',

398

coef0=0.0,

399

shrinking=True,

400

tol=1e-3,

401

cache_size=200,

402

verbose=False,

403

max_iter=-1

404

):

405

"""

406

Initialize Nu Support Vector Regressor.

407

408

Parameters:

409

nu (float): Upper bound on fraction of training errors (0 < nu <= 1)

410

C (float): Regularization parameter

411

kernel (str): Kernel type ('linear', 'poly', 'rbf', 'sigmoid', 'precomputed')

412

degree (int): Degree for poly kernel

413

gamma (str or float): Kernel coefficient ('scale', 'auto', or float)

414

coef0 (float): Independent term for poly/sigmoid kernels

415

shrinking (bool): Whether to use shrinking heuristic

416

tol (float): Tolerance for stopping criterion

417

cache_size (float): Size of kernel cache (MB)

418

verbose (bool): Enable verbose output

419

max_iter (int): Hard limit on iterations (-1 for no limit)

420

"""

421

422

def fit(self, X, y, sample_weight=None):

423

"""

424

Fit the Nu-SVM model according to training data.

425

426

Parameters:

427

X (array-like): Training vectors of shape (n_samples, n_features)

428

y (array-like): Target values of shape (n_samples,)

429

sample_weight (array-like): Per-sample weights

430

431

Returns:

432

self: Fitted estimator

433

"""

434

435

def predict(self, X):

436

"""

437

Perform regression on samples in X.

438

439

Parameters:

440

X (array-like): Samples of shape (n_samples, n_features)

441

442

Returns:

443

array: Predicted values for samples

444

"""

445

446

def score(self, X, y, sample_weight=None):

447

"""

448

Return coefficient of determination R^2 of prediction.

449

450

Parameters:

451

X (array-like): Test samples

452

y (array-like): True values

453

sample_weight (array-like): Sample weights

454

455

Returns:

456

float: R^2 score

457

"""

458

459

# Attributes available after fitting

460

support_: ... # Indices of support vectors

461

support_vectors_: ... # Support vectors

462

dual_coef_: ... # Coefficients of support vectors in decision function

463

coef_: ... # Weights assigned to features (linear kernel only)

464

intercept_: ... # Constants in decision function

465

gamma_: ... # Current gamma value

466

shape_fit_: ... # Array dimensions of training vector X

467

n_features_in_: ... # Number of features seen during fit

468

```

469

470

## Usage Examples

471

472

### Support Vector Classification

473

474

```python

475

import numpy as np

476

from sklearnex.svm import SVC

477

from sklearn.datasets import make_classification

478

from sklearn.model_selection import train_test_split

479

from sklearn.preprocessing import StandardScaler

480

481

# Generate sample data

482

X, y = make_classification(n_samples=1000, n_features=20, n_informative=10,

483

n_redundant=10, n_classes=3, random_state=42)

484

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

485

486

# Scale features for better SVM performance

487

scaler = StandardScaler()

488

X_train_scaled = scaler.fit_transform(X_train)

489

X_test_scaled = scaler.transform(X_test)

490

491

# Create and fit SVC

492

svc = SVC(kernel='rbf', C=1.0, gamma='scale', probability=True, random_state=42)

493

svc.fit(X_train_scaled, y_train)

494

495

# Make predictions

496

y_pred = svc.predict(X_test_scaled)

497

y_proba = svc.predict_proba(X_test_scaled)

498

decision_scores = svc.decision_function(X_test_scaled)

499

500

print(f"Accuracy: {svc.score(X_test_scaled, y_test):.3f}")

501

print(f"Classes: {svc.classes_}")

502

print(f"Number of support vectors: {svc.n_support_}")

503

print(f"Total support vectors: {len(svc.support_)}")

504

print(f"Decision function shape: {decision_scores.shape}")

505

506

# Linear SVM example

507

svc_linear = SVC(kernel='linear', C=1.0)

508

svc_linear.fit(X_train_scaled, y_train)

509

510

print(f"Linear SVM accuracy: {svc_linear.score(X_test_scaled, y_test):.3f}")

511

print(f"Linear coefficients shape: {svc_linear.coef_.shape}")

512

print(f"Intercept: {svc_linear.intercept_}")

513

```

514

515

### Support Vector Regression

516

517

```python

518

import numpy as np

519

from sklearnex.svm import SVR

520

from sklearn.datasets import make_regression

521

from sklearn.model_selection import train_test_split

522

from sklearn.preprocessing import StandardScaler

523

from sklearn.metrics import mean_squared_error, r2_score

524

525

# Generate sample data

526

X, y = make_regression(n_samples=1000, n_features=10, noise=0.1, random_state=42)

527

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

528

529

# Scale features

530

scaler = StandardScaler()

531

X_train_scaled = scaler.fit_transform(X_train)

532

X_test_scaled = scaler.transform(X_test)

533

534

# Create and fit SVR

535

svr = SVR(kernel='rbf', C=100, gamma=0.1, epsilon=0.1)

536

svr.fit(X_train_scaled, y_train)

537

538

# Make predictions

539

y_pred = svr.predict(X_test_scaled)

540

541

print(f"R² Score: {svr.score(X_test_scaled, y_test):.3f}")

542

print(f"MSE: {mean_squared_error(y_test, y_pred):.3f}")

543

print(f"Number of support vectors: {len(svr.support_)}")

544

545

# Linear SVR example

546

svr_linear = SVR(kernel='linear', C=1.0, epsilon=0.2)

547

svr_linear.fit(X_train_scaled, y_train)

548

y_pred_linear = svr_linear.predict(X_test_scaled)

549

550

print(f"Linear SVR R² Score: {svr_linear.score(X_test_scaled, y_test):.3f}")

551

print(f"Linear coefficients shape: {svr_linear.coef_.shape}")

552

553

# Polynomial SVR example

554

svr_poly = SVR(kernel='poly', degree=3, C=1.0, epsilon=0.1)

555

svr_poly.fit(X_train_scaled, y_train)

556

y_pred_poly = svr_poly.predict(X_test_scaled)

557

558

print(f"Polynomial SVR R² Score: {svr_poly.score(X_test_scaled, y_test):.3f}")

559

```

560

561

### Nu Support Vector Machines

562

563

```python

564

import numpy as np

565

from sklearnex.svm import NuSVC, NuSVR

566

from sklearn.datasets import make_classification, make_regression

567

from sklearn.model_selection import train_test_split

568

from sklearn.preprocessing import StandardScaler

569

570

# Nu-SVC Example

571

X_class, y_class = make_classification(n_samples=800, n_features=15, n_classes=2, random_state=42)

572

X_train_c, X_test_c, y_train_c, y_test_c = train_test_split(X_class, y_class, test_size=0.2, random_state=42)

573

574

scaler_c = StandardScaler()

575

X_train_c_scaled = scaler_c.fit_transform(X_train_c)

576

X_test_c_scaled = scaler_c.transform(X_test_c)

577

578

# Nu-SVC with different nu values

579

for nu in [0.1, 0.3, 0.5, 0.7]:

580

nu_svc = NuSVC(nu=nu, kernel='rbf', probability=True, random_state=42)

581

nu_svc.fit(X_train_c_scaled, y_train_c)

582

583

accuracy = nu_svc.score(X_test_c_scaled, y_test_c)

584

n_sv = len(nu_svc.support_)

585

sv_fraction = n_sv / len(X_train_c_scaled)

586

587

print(f"Nu={nu}: Accuracy={accuracy:.3f}, Support Vectors={n_sv} ({sv_fraction:.1%})")

588

589

# Nu-SVR Example

590

X_reg, y_reg = make_regression(n_samples=800, n_features=10, noise=0.1, random_state=42)

591

X_train_r, X_test_r, y_train_r, y_test_r = train_test_split(X_reg, y_reg, test_size=0.2, random_state=42)

592

593

scaler_r = StandardScaler()

594

X_train_r_scaled = scaler_r.fit_transform(X_train_r)

595

X_test_r_scaled = scaler_r.transform(X_test_r)

596

597

# Nu-SVR with different nu values

598

for nu in [0.1, 0.3, 0.5, 0.7]:

599

nu_svr = NuSVR(nu=nu, kernel='rbf', C=100)

600

nu_svr.fit(X_train_r_scaled, y_train_r)

601

602

r2 = nu_svr.score(X_test_r_scaled, y_test_r)

603

n_sv = len(nu_svr.support_)

604

sv_fraction = n_sv / len(X_train_r_scaled)

605

606

print(f"Nu={nu}: R²={r2:.3f}, Support Vectors={n_sv} ({sv_fraction:.1%})")

607

```

608

609

### Kernel Comparison and Parameter Tuning

610

611

```python

612

import numpy as np

613

from sklearnex.svm import SVC

614

from sklearn.datasets import make_classification

615

from sklearn.model_selection import train_test_split, GridSearchCV

616

from sklearn.preprocessing import StandardScaler

617

618

# Generate sample data

619

X, y = make_classification(n_samples=1000, n_features=20, n_informative=15,

620

n_classes=2, random_state=42)

621

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

622

623

scaler = StandardScaler()

624

X_train_scaled = scaler.fit_transform(X_train)

625

X_test_scaled = scaler.transform(X_test)

626

627

# Compare different kernels

628

kernels = ['linear', 'poly', 'rbf', 'sigmoid']

629

results = {}

630

631

for kernel in kernels:

632

if kernel == 'poly':

633

svc = SVC(kernel=kernel, degree=3, C=1.0, random_state=42)

634

else:

635

svc = SVC(kernel=kernel, C=1.0, random_state=42)

636

637

svc.fit(X_train_scaled, y_train)

638

accuracy = svc.score(X_test_scaled, y_test)

639

n_sv = len(svc.support_)

640

641

results[kernel] = {'accuracy': accuracy, 'support_vectors': n_sv}

642

print(f"{kernel.capitalize()} kernel: Accuracy={accuracy:.3f}, SVs={n_sv}")

643

644

# Grid search for best parameters

645

param_grid = {

646

'C': [0.1, 1, 10, 100],

647

'gamma': ['scale', 'auto', 0.001, 0.01, 0.1, 1],

648

'kernel': ['rbf', 'poly']

649

}

650

651

svc_grid = SVC(random_state=42)

652

grid_search = GridSearchCV(svc_grid, param_grid, cv=5, scoring='accuracy', n_jobs=-1)

653

grid_search.fit(X_train_scaled, y_train)

654

655

print(f"\nBest parameters: {grid_search.best_params_}")

656

print(f"Best cross-validation score: {grid_search.best_score_:.3f}")

657

print(f"Test accuracy: {grid_search.score(X_test_scaled, y_test):.3f}")

658

659

# Analyze best model

660

best_svc = grid_search.best_estimator_

661

print(f"Best model support vectors: {len(best_svc.support_)}")

662

print(f"Support vector ratio: {len(best_svc.support_) / len(X_train_scaled):.1%}")

663

```

664

665

### Performance Comparison

666

667

```python

668

import time

669

import numpy as np

670

from sklearn.datasets import make_classification

671

from sklearn.model_selection import train_test_split

672

from sklearn.preprocessing import StandardScaler

673

674

# Generate large dataset

675

X, y = make_classification(n_samples=20000, n_features=20, n_informative=15,

676

n_classes=2, random_state=42)

677

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

678

679

scaler = StandardScaler()

680

X_train_scaled = scaler.fit_transform(X_train)

681

X_test_scaled = scaler.transform(X_test)

682

683

# Intel-optimized version

684

from sklearnex.svm import SVC as IntelSVC

685

686

start_time = time.time()

687

intel_svc = IntelSVC(kernel='rbf', C=1.0, gamma='scale', random_state=42)

688

intel_svc.fit(X_train_scaled, y_train)

689

intel_pred = intel_svc.predict(X_test_scaled)

690

intel_time = time.time() - start_time

691

692

print(f"Intel SVC time: {intel_time:.2f} seconds")

693

print(f"Intel SVC accuracy: {intel_svc.score(X_test_scaled, y_test):.3f}")

694

print(f"Intel support vectors: {len(intel_svc.support_)}")

695

696

# Standard scikit-learn version (for comparison)

697

from sklearn.svm import SVC as StandardSVC

698

699

start_time = time.time()

700

standard_svc = StandardSVC(kernel='rbf', C=1.0, gamma='scale', random_state=42)

701

standard_svc.fit(X_train_scaled, y_train)

702

standard_pred = standard_svc.predict(X_test_scaled)

703

standard_time = time.time() - start_time

704

705

print(f"Standard SVC time: {standard_time:.2f} seconds")

706

print(f"Standard SVC accuracy: {standard_svc.score(X_test_scaled, y_test):.3f}")

707

print(f"Standard support vectors: {len(standard_svc.support_)}")

708

print(f"Speedup: {standard_time / intel_time:.1f}x")

709

710

# Verify results are similar (may have slight differences due to optimization)

711

print(f"Accuracy difference: {abs(intel_svc.score(X_test_scaled, y_test) - standard_svc.score(X_test_scaled, y_test)):.4f}")

712

```

713

714

## Performance Notes

715

716

- SVM algorithms show significant speedups on datasets with >5000 samples

717

- RBF and polynomial kernels benefit most from Intel optimization

718

- Training time improvements are most noticeable with complex kernels

719

- Prediction performance gains increase with the number of support vectors

720

- Memory usage is comparable to standard scikit-learn versions

721

- Results maintain high compatibility with scikit-learn implementations