or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

datasets.mdfeature-extraction.mdindex.mdmetrics.mdmodel-selection.mdneighbors.mdpipelines.mdpreprocessing.mdsupervised-learning.mdunsupervised-learning.mdutilities.md

supervised-learning.mddocs/

0

# Supervised Learning

1

2

This document covers all supervised learning algorithms in scikit-learn, including classification and regression methods.

3

4

## Linear Models

5

6

### Regression

7

8

#### LinearRegression { .api }

9

```python

10

from sklearn.linear_model import LinearRegression

11

12

LinearRegression(

13

fit_intercept: bool = True,

14

copy_X: bool = True,

15

tol: float = 1e-6,

16

n_jobs: int | None = None,

17

positive: bool = False

18

)

19

```

20

Ordinary least squares Linear Regression.

21

22

#### Ridge { .api }

23

```python

24

from sklearn.linear_model import Ridge

25

26

Ridge(

27

alpha: float = 1.0,

28

fit_intercept: bool = True,

29

copy_X: bool = True,

30

max_iter: int | None = None,

31

tol: float = 0.0001,

32

solver: str = "auto",

33

positive: bool = False,

34

random_state: int | RandomState | None = None

35

)

36

```

37

Linear least squares with l2 regularization.

38

39

#### RidgeCV { .api }

40

```python

41

from sklearn.linear_model import RidgeCV

42

43

RidgeCV(

44

alphas: ArrayLike = (0.1, 1.0, 10.0),

45

fit_intercept: bool = True,

46

scoring: str | Callable | None = None,

47

cv: int | BaseCrossValidator | Iterable | None = None,

48

gcv_mode: str | None = None,

49

store_cv_values: bool = False,

50

alpha_per_target: bool = False

51

)

52

```

53

Ridge regression with built-in cross-validation.

54

55

#### Lasso { .api }

56

```python

57

from sklearn.linear_model import Lasso

58

59

Lasso(

60

alpha: float = 1.0,

61

fit_intercept: bool = True,

62

precompute: bool | ArrayLike = False,

63

copy_X: bool = True,

64

max_iter: int = 1000,

65

tol: float = 0.0001,

66

warm_start: bool = False,

67

positive: bool = False,

68

random_state: int | RandomState | None = None,

69

selection: str = "cyclic"

70

)

71

```

72

Linear Model trained with L1 prior as regularizer (aka the Lasso).

73

74

#### LassoCV { .api }

75

```python

76

from sklearn.linear_model import LassoCV

77

78

LassoCV(

79

eps: float = 0.001,

80

n_alphas: int = 100,

81

alphas: ArrayLike | None = None,

82

fit_intercept: bool = True,

83

precompute: bool | str | ArrayLike = "auto",

84

max_iter: int = 1000,

85

tol: float = 0.0001,

86

copy_X: bool = True,

87

cv: int | BaseCrossValidator | Iterable | None = None,

88

verbose: bool | int = False,

89

n_jobs: int | None = None,

90

positive: bool = False,

91

random_state: int | RandomState | None = None,

92

selection: str = "cyclic"

93

)

94

```

95

Lasso linear model with iterative fitting along a regularization path.

96

97

#### ElasticNet { .api }

98

```python

99

from sklearn.linear_model import ElasticNet

100

101

ElasticNet(

102

alpha: float = 1.0,

103

l1_ratio: float = 0.5,

104

fit_intercept: bool = True,

105

precompute: bool | ArrayLike = False,

106

max_iter: int = 1000,

107

copy_X: bool = True,

108

tol: float = 0.0001,

109

warm_start: bool = False,

110

positive: bool = False,

111

random_state: int | RandomState | None = None,

112

selection: str = "cyclic"

113

)

114

```

115

Linear regression with combined L1 and L2 priors as regularizer.

116

117

#### ElasticNetCV { .api }

118

```python

119

from sklearn.linear_model import ElasticNetCV

120

121

ElasticNetCV(

122

l1_ratio: float | ArrayLike = 0.5,

123

eps: float = 0.001,

124

n_alphas: int = 100,

125

alphas: ArrayLike | None = None,

126

fit_intercept: bool = True,

127

precompute: bool | str | ArrayLike = "auto",

128

max_iter: int = 1000,

129

tol: float = 0.0001,

130

cv: int | BaseCrossValidator | Iterable | None = None,

131

copy_X: bool = True,

132

verbose: bool | int = False,

133

n_jobs: int | None = None,

134

positive: bool = False,

135

random_state: int | RandomState | None = None,

136

selection: str = "cyclic"

137

)

138

```

139

Elastic Net model with iterative fitting along a regularization path.

140

141

#### Lars { .api }

142

```python

143

from sklearn.linear_model import Lars

144

145

Lars(

146

fit_intercept: bool = True,

147

verbose: bool | int = False,

148

precompute: bool | str | ArrayLike = "auto",

149

n_nonzero_coefs: int = 500,

150

eps: float = ...,

151

copy_X: bool = True,

152

fit_path: bool = True,

153

jitter: float | None = None,

154

random_state: int | RandomState | None = None

155

)

156

```

157

Least Angle Regression model a.k.a. LAR.

158

159

#### LarsCV { .api }

160

```python

161

from sklearn.linear_model import LarsCV

162

163

LarsCV(

164

fit_intercept: bool = True,

165

verbose: bool | int = False,

166

max_iter: int = 500,

167

precompute: bool | str | ArrayLike = "auto",

168

cv: int | BaseCrossValidator | Iterable | None = None,

169

max_n_alphas: int = 1000,

170

n_jobs: int | None = None,

171

eps: float = ...,

172

copy_X: bool = True

173

)

174

```

175

Cross-validated Least Angle Regression model.

176

177

#### LassoLars { .api }

178

```python

179

from sklearn.linear_model import LassoLars

180

181

LassoLars(

182

alpha: float = 1.0,

183

fit_intercept: bool = True,

184

verbose: bool | int = False,

185

precompute: bool | str | ArrayLike = "auto",

186

max_iter: int = 500,

187

eps: float = ...,

188

copy_X: bool = True,

189

fit_path: bool = True,

190

positive: bool = False,

191

jitter: float | None = None,

192

random_state: int | RandomState | None = None

193

)

194

```

195

Lasso model fit with Least Angle Regression a.k.a. Lars.

196

197

#### LassoLarsCV { .api }

198

```python

199

from sklearn.linear_model import LassoLarsCV

200

201

LassoLarsCV(

202

fit_intercept: bool = True,

203

verbose: bool | int = False,

204

max_iter: int = 500,

205

precompute: bool | str | ArrayLike = "auto",

206

cv: int | BaseCrossValidator | Iterable | None = None,

207

max_n_alphas: int = 1000,

208

n_jobs: int | None = None,

209

eps: float = ...,

210

copy_X: bool = True,

211

positive: bool = False

212

)

213

```

214

Cross-validated Lasso, using the LARS algorithm.

215

216

#### LassoLarsIC { .api }

217

```python

218

from sklearn.linear_model import LassoLarsIC

219

220

LassoLarsIC(

221

criterion: str = "aic",

222

fit_intercept: bool = True,

223

verbose: bool | int = False,

224

precompute: bool | str | ArrayLike = "auto",

225

max_iter: int = 500,

226

eps: float = ...,

227

copy_X: bool = True,

228

positive: bool = False,

229

noise_variance: float | None = None

230

)

231

```

232

Lasso model fit with Lars using BIC or AIC for model selection.

233

234

#### OrthogonalMatchingPursuit { .api }

235

```python

236

from sklearn.linear_model import OrthogonalMatchingPursuit

237

238

OrthogonalMatchingPursuit(

239

n_nonzero_coefs: int | None = None,

240

tol: float | None = None,

241

fit_intercept: bool = True,

242

precompute: bool | str | ArrayLike = "auto"

243

)

244

```

245

Orthogonal Matching Pursuit model (OMP).

246

247

#### OrthogonalMatchingPursuitCV { .api }

248

```python

249

from sklearn.linear_model import OrthogonalMatchingPursuitCV

250

251

OrthogonalMatchingPursuitCV(

252

copy: bool = True,

253

fit_intercept: bool = True,

254

max_iter: int | None = None,

255

cv: int | BaseCrossValidator | Iterable | None = None,

256

n_jobs: int | None = None,

257

verbose: bool | int = False

258

)

259

```

260

Cross-validated Orthogonal Matching Pursuit model (OMP).

261

262

#### BayesianRidge { .api }

263

```python

264

from sklearn.linear_model import BayesianRidge

265

266

BayesianRidge(

267

max_iter: int = 300,

268

tol: float = 0.001,

269

alpha_1: float = 1e-06,

270

alpha_2: float = 1e-06,

271

lambda_1: float = 1e-06,

272

lambda_2: float = 1e-06,

273

alpha_init: float | None = None,

274

lambda_init: float | None = None,

275

compute_score: bool = False,

276

fit_intercept: bool = True,

277

copy_X: bool = True,

278

verbose: bool = False

279

)

280

```

281

Bayesian ridge regression.

282

283

#### ARDRegression { .api }

284

```python

285

from sklearn.linear_model import ARDRegression

286

287

ARDRegression(

288

max_iter: int = 300,

289

tol: float = 0.001,

290

alpha_1: float = 1e-06,

291

alpha_2: float = 1e-06,

292

lambda_1: float = 1e-06,

293

lambda_2: float = 1e-06,

294

compute_score: bool = False,

295

threshold_lambda: float = 10000.0,

296

fit_intercept: bool = True,

297

copy_X: bool = True,

298

verbose: bool = False

299

)

300

```

301

Bayesian ARD regression.

302

303

#### MultiTaskLasso { .api }

304

```python

305

from sklearn.linear_model import MultiTaskLasso

306

307

MultiTaskLasso(

308

alpha: float = 1.0,

309

fit_intercept: bool = True,

310

copy_X: bool = True,

311

max_iter: int = 1000,

312

tol: float = 0.0001,

313

warm_start: bool = False,

314

random_state: int | RandomState | None = None,

315

selection: str = "cyclic"

316

)

317

```

318

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

319

320

#### MultiTaskLassoCV { .api }

321

```python

322

from sklearn.linear_model import MultiTaskLassoCV

323

324

MultiTaskLassoCV(

325

eps: float = 0.001,

326

n_alphas: int = 100,

327

alphas: ArrayLike | None = None,

328

fit_intercept: bool = True,

329

max_iter: int = 1000,

330

tol: float = 0.0001,

331

copy_X: bool = True,

332

cv: int | BaseCrossValidator | Iterable | None = None,

333

verbose: bool | int = False,

334

n_jobs: int | None = None,

335

random_state: int | RandomState | None = None,

336

selection: str = "cyclic"

337

)

338

```

339

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

340

341

#### MultiTaskElasticNet { .api }

342

```python

343

from sklearn.linear_model import MultiTaskElasticNet

344

345

MultiTaskElasticNet(

346

alpha: float = 1.0,

347

l1_ratio: float = 0.5,

348

fit_intercept: bool = True,

349

copy_X: bool = True,

350

max_iter: int = 1000,

351

tol: float = 0.0001,

352

warm_start: bool = False,

353

random_state: int | RandomState | None = None,

354

selection: str = "cyclic"

355

)

356

```

357

Multi-task ElasticNet model trained with L1/L2 mixed-norm as regularizer.

358

359

#### MultiTaskElasticNetCV { .api }

360

```python

361

from sklearn.linear_model import MultiTaskElasticNetCV

362

363

MultiTaskElasticNetCV(

364

l1_ratio: float | ArrayLike = 0.5,

365

eps: float = 0.001,

366

n_alphas: int = 100,

367

alphas: ArrayLike | None = None,

368

fit_intercept: bool = True,

369

max_iter: int = 1000,

370

tol: float = 0.0001,

371

cv: int | BaseCrossValidator | Iterable | None = None,

372

copy_X: bool = True,

373

verbose: bool | int = False,

374

n_jobs: int | None = None,

375

random_state: int | RandomState | None = None,

376

selection: str = "cyclic"

377

)

378

```

379

Multi-task L1/L2 ElasticNet with built-in cross-validation.

380

381

#### HuberRegressor { .api }

382

```python

383

from sklearn.linear_model import HuberRegressor

384

385

HuberRegressor(

386

epsilon: float = 1.35,

387

max_iter: int = 100,

388

alpha: float = 0.0001,

389

warm_start: bool = False,

390

fit_intercept: bool = True,

391

tol: float = 1e-05

392

)

393

```

394

Linear regression model that is robust to outliers.

395

396

#### RANSACRegressor { .api }

397

```python

398

from sklearn.linear_model import RANSACRegressor

399

400

RANSACRegressor(

401

estimator: object | None = None,

402

min_samples: int | float | None = None,

403

residual_threshold: float | None = None,

404

is_data_valid: Callable | None = None,

405

is_model_valid: Callable | None = None,

406

max_trials: int = 100,

407

max_skips: int = ...,

408

stop_n_inliers: int = ...,

409

stop_score: float = ...,

410

stop_probability: float = 0.99,

411

loss: str | Callable = "absolute_error",

412

random_state: int | RandomState | None = None,

413

base_estimator: object = "deprecated"

414

)

415

```

416

RANSAC (RANdom SAmple Consensus) algorithm.

417

418

#### TheilSenRegressor { .api }

419

```python

420

from sklearn.linear_model import TheilSenRegressor

421

422

TheilSenRegressor(

423

fit_intercept: bool = True,

424

copy_X: bool = True,

425

max_subpopulation: int = 10000,

426

n_subsamples: int | None = None,

427

max_iter: int = 300,

428

tol: float = 0.001,

429

random_state: int | RandomState | None = None,

430

n_jobs: int | None = None,

431

verbose: bool = False

432

)

433

```

434

Theil-Sen Estimator: robust multivariate regression model.

435

436

#### PassiveAggressiveRegressor { .api }

437

```python

438

from sklearn.linear_model import PassiveAggressiveRegressor

439

440

PassiveAggressiveRegressor(

441

C: float = 1.0,

442

fit_intercept: bool = True,

443

max_iter: int = 1000,

444

tol: float = 0.001,

445

early_stopping: bool = False,

446

validation_fraction: float = 0.1,

447

n_iter_no_change: int = 5,

448

shuffle: bool = True,

449

verbose: int = 0,

450

loss: str = "epsilon_insensitive",

451

epsilon: float = 0.1,

452

random_state: int | RandomState | None = None,

453

warm_start: bool = False,

454

average: bool | int = False

455

)

456

```

457

Passive Aggressive Regressor.

458

459

#### SGDRegressor { .api }

460

```python

461

from sklearn.linear_model import SGDRegressor

462

463

SGDRegressor(

464

loss: str = "squared_error",

465

penalty: str = "l2",

466

alpha: float = 0.0001,

467

l1_ratio: float = 0.15,

468

fit_intercept: bool = True,

469

max_iter: int = 1000,

470

tol: float = 0.001,

471

shuffle: bool = True,

472

verbose: int = 0,

473

epsilon: float = 0.1,

474

random_state: int | RandomState | None = None,

475

learning_rate: str = "invscaling",

476

eta0: float = 0.01,

477

power_t: float = 0.25,

478

early_stopping: bool = False,

479

validation_fraction: float = 0.1,

480

n_iter_no_change: int = 5,

481

warm_start: bool = False,

482

average: bool | int = False

483

)

484

```

485

Linear model fitted by minimizing a regularized empirical loss with SGD.

486

487

#### TweedieRegressor { .api }

488

```python

489

from sklearn.linear_model import TweedieRegressor

490

491

TweedieRegressor(

492

power: float = 0.0,

493

alpha: float = 1.0,

494

fit_intercept: bool = True,

495

link: str = "auto",

496

solver: str = "lbfgs",

497

max_iter: int = 100,

498

tol: float = 0.0001,

499

warm_start: bool = False,

500

verbose: int = 0

501

)

502

```

503

Generalized Linear Model with a Tweedie distribution.

504

505

#### PoissonRegressor { .api }

506

```python

507

from sklearn.linear_model import PoissonRegressor

508

509

PoissonRegressor(

510

alpha: float = 1.0,

511

fit_intercept: bool = True,

512

solver: str = "lbfgs",

513

max_iter: int = 100,

514

tol: float = 0.0001,

515

warm_start: bool = False,

516

verbose: int = 0

517

)

518

```

519

Generalized Linear Model with a Poisson distribution.

520

521

#### GammaRegressor { .api }

522

```python

523

from sklearn.linear_model import GammaRegressor

524

525

GammaRegressor(

526

alpha: float = 1.0,

527

fit_intercept: bool = True,

528

solver: str = "lbfgs",

529

max_iter: int = 100,

530

tol: float = 0.0001,

531

warm_start: bool = False,

532

verbose: int = 0

533

)

534

```

535

Generalized Linear Model with a Gamma distribution.

536

537

#### QuantileRegressor { .api }

538

```python

539

from sklearn.linear_model import QuantileRegressor

540

541

QuantileRegressor(

542

quantile: float = 0.5,

543

alpha: float = 1.0,

544

fit_intercept: bool = True,

545

solver: str = "interior-point",

546

solver_options: dict | None = None

547

)

548

```

549

Linear regression model that predicts conditional quantiles.

550

551

### Classification

552

553

#### LogisticRegression { .api }

554

```python

555

from sklearn.linear_model import LogisticRegression

556

557

LogisticRegression(

558

penalty: str | None = "l2",

559

dual: bool = False,

560

tol: float = 0.0001,

561

C: float = 1.0,

562

fit_intercept: bool = True,

563

intercept_scaling: float = 1,

564

class_weight: dict | str | None = None,

565

random_state: int | RandomState | None = None,

566

solver: str = "lbfgs",

567

max_iter: int = 100,

568

multi_class: str = "auto",

569

verbose: int = 0,

570

warm_start: bool = False,

571

n_jobs: int | None = None,

572

l1_ratio: float | None = None

573

)

574

```

575

Logistic Regression (aka logit, MaxEnt) classifier.

576

577

#### LogisticRegressionCV { .api }

578

```python

579

from sklearn.linear_model import LogisticRegressionCV

580

581

LogisticRegressionCV(

582

Cs: int | ArrayLike = 10,

583

fit_intercept: bool = True,

584

cv: int | BaseCrossValidator | Iterable | None = None,

585

dual: bool = False,

586

penalty: str = "l2",

587

scoring: str | Callable | None = None,

588

solver: str = "lbfgs",

589

tol: float = 0.0001,

590

max_iter: int = 100,

591

class_weight: dict | str | None = None,

592

n_jobs: int | None = None,

593

verbose: int = 0,

594

refit: bool = True,

595

intercept_scaling: float = 1.0,

596

multi_class: str = "auto",

597

random_state: int | RandomState | None = None,

598

l1_ratios: ArrayLike | None = None

599

)

600

```

601

Logistic Regression CV (aka logit, MaxEnt) classifier.

602

603

#### RidgeClassifier { .api }

604

```python

605

from sklearn.linear_model import RidgeClassifier

606

607

RidgeClassifier(

608

alpha: float = 1.0,

609

fit_intercept: bool = True,

610

copy_X: bool = True,

611

max_iter: int | None = None,

612

tol: float = 0.0001,

613

class_weight: dict | str | None = None,

614

solver: str = "auto",

615

positive: bool = False,

616

random_state: int | RandomState | None = None

617

)

618

```

619

Classifier using Ridge regression.

620

621

#### RidgeClassifierCV { .api }

622

```python

623

from sklearn.linear_model import RidgeClassifierCV

624

625

RidgeClassifierCV(

626

alphas: ArrayLike = (0.1, 1.0, 10.0),

627

fit_intercept: bool = True,

628

scoring: str | Callable | None = None,

629

cv: int | BaseCrossValidator | Iterable | None = None,

630

class_weight: dict | str | None = None,

631

store_cv_values: bool = False

632

)

633

```

634

Ridge classifier with built-in cross-validation.

635

636

#### SGDClassifier { .api }

637

```python

638

from sklearn.linear_model import SGDClassifier

639

640

SGDClassifier(

641

loss: str = "hinge",

642

penalty: str = "l2",

643

alpha: float = 0.0001,

644

l1_ratio: float = 0.15,

645

fit_intercept: bool = True,

646

max_iter: int = 1000,

647

tol: float = 0.001,

648

shuffle: bool = True,

649

verbose: int = 0,

650

epsilon: float = 0.1,

651

n_jobs: int | None = None,

652

random_state: int | RandomState | None = None,

653

learning_rate: str = "optimal",

654

eta0: float = 0.0,

655

power_t: float = 0.5,

656

early_stopping: bool = False,

657

validation_fraction: float = 0.1,

658

n_iter_no_change: int = 5,

659

class_weight: dict | str | None = None,

660

warm_start: bool = False,

661

average: bool | int = False

662

)

663

```

664

Linear classifiers (SVM, logistic regression, etc.) with SGD training.

665

666

#### SGDOneClassSVM { .api }

667

```python

668

from sklearn.linear_model import SGDOneClassSVM

669

670

SGDOneClassSVM(

671

nu: float = 0.5,

672

fit_intercept: bool = True,

673

max_iter: int = 1000,

674

tol: float = 0.001,

675

shuffle: bool = True,

676

verbose: int = 0,

677

random_state: int | RandomState | None = None,

678

learning_rate: str = "optimal",

679

eta0: float = 0.0,

680

power_t: float = 0.5,

681

warm_start: bool = False,

682

average: bool | int = False

683

)

684

```

685

Solves linear One-Class SVM using Stochastic Gradient Descent.

686

687

#### Perceptron { .api }

688

```python

689

from sklearn.linear_model import Perceptron

690

691

Perceptron(

692

penalty: str | None = None,

693

alpha: float = 0.0001,

694

l1_ratio: float = 0.15,

695

fit_intercept: bool = True,

696

max_iter: int = 1000,

697

tol: float = 0.001,

698

shuffle: bool = True,

699

verbose: int = 0,

700

eta0: float = 1.0,

701

n_jobs: int | None = None,

702

random_state: int | RandomState | None = None,

703

early_stopping: bool = False,

704

validation_fraction: float = 0.1,

705

n_iter_no_change: int = 5,

706

class_weight: dict | str | None = None,

707

warm_start: bool = False

708

)

709

```

710

Perceptron classifier.

711

712

#### PassiveAggressiveClassifier { .api }

713

```python

714

from sklearn.linear_model import PassiveAggressiveClassifier

715

716

PassiveAggressiveClassifier(

717

C: float = 1.0,

718

fit_intercept: bool = True,

719

max_iter: int = 1000,

720

tol: float = 0.001,

721

early_stopping: bool = False,

722

validation_fraction: float = 0.1,

723

n_iter_no_change: int = 5,

724

shuffle: bool = True,

725

verbose: int = 0,

726

loss: str = "hinge",

727

n_jobs: int | None = None,

728

random_state: int | RandomState | None = None,

729

warm_start: bool = False,

730

class_weight: dict | str | None = None,

731

average: bool | int = False

732

)

733

```

734

Passive Aggressive Classifier.

735

736

### Linear Model Functions

737

738

#### ridge_regression { .api }

739

```python

740

from sklearn.linear_model import ridge_regression

741

742

ridge_regression(

743

X: ArrayLike,

744

y: ArrayLike,

745

alpha: float | ArrayLike,

746

sample_weight: ArrayLike | None = None,

747

solver: str = "auto",

748

max_iter: int | None = None,

749

tol: float = 0.0001,

750

verbose: int = 0,

751

positive: bool = False,

752

random_state: int | RandomState | None = None,

753

return_n_iter: bool = False,

754

return_intercept: bool = False,

755

check_input: bool = True

756

) -> ArrayLike | tuple[ArrayLike, int] | tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, int, ArrayLike]

757

```

758

Solve the ridge equation by the method of normal equations.

759

760

#### lasso_path { .api }

761

```python

762

from sklearn.linear_model import lasso_path

763

764

lasso_path(

765

X: ArrayLike,

766

y: ArrayLike,

767

eps: float = 0.001,

768

n_alphas: int = 100,

769

alphas: ArrayLike | None = None,

770

precompute: bool | str | ArrayLike = "auto",

771

Xy: ArrayLike | None = None,

772

copy_X: bool = True,

773

coef_init: ArrayLike | None = None,

774

verbose: bool | int = False,

775

return_n_iter: bool = False,

776

positive: bool = False,

777

**params

778

) -> tuple[ArrayLike, ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike, ArrayLike]

779

```

780

Compute Lasso path with coordinate descent.

781

782

#### lars_path { .api }

783

```python

784

from sklearn.linear_model import lars_path

785

786

lars_path(

787

X: ArrayLike,

788

y: ArrayLike,

789

Xy: ArrayLike | None = None,

790

Gram: ArrayLike | None = None,

791

max_iter: int = 500,

792

alpha_min: float = 0,

793

method: str = "lar",

794

copy_X: bool = True,

795

eps: float = ...,

796

copy_Gram: bool = True,

797

verbose: int = 0,

798

return_path: bool = True,

799

return_n_iter: bool = False,

800

positive: bool = False

801

) -> tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, int] | tuple[ArrayLike, ArrayLike, ArrayLike, int]

802

```

803

Compute Least Angle Regression or Lasso path using LARS algorithm.

804

805

#### lars_path_gram { .api }

806

```python

807

from sklearn.linear_model import lars_path_gram

808

809

lars_path_gram(

810

Xy: ArrayLike,

811

Gram: ArrayLike,

812

n_samples: int,

813

max_iter: int = 500,

814

alpha_min: float = 0,

815

method: str = "lar",

816

copy_X: bool = True,

817

eps: float = ...,

818

copy_Gram: bool = True,

819

verbose: int = 0,

820

return_path: bool = True,

821

return_n_iter: bool = False,

822

positive: bool = False

823

) -> tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, int] | tuple[ArrayLike, ArrayLike, ArrayLike, int]

824

```

825

lars_path in the sufficient stats mode.

826

827

#### enet_path { .api }

828

```python

829

from sklearn.linear_model import enet_path

830

831

enet_path(

832

X: ArrayLike,

833

y: ArrayLike,

834

l1_ratio: float = 0.5,

835

eps: float = 0.001,

836

n_alphas: int = 100,

837

alphas: ArrayLike | None = None,

838

precompute: bool | str | ArrayLike = "auto",

839

Xy: ArrayLike | None = None,

840

copy_X: bool = True,

841

coef_init: ArrayLike | None = None,

842

verbose: bool | int = False,

843

return_n_iter: bool = False,

844

positive: bool = False,

845

check_input: bool = True,

846

**params

847

) -> tuple[ArrayLike, ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike, ArrayLike]

848

```

849

Compute elastic net path with coordinate descent.

850

851

#### orthogonal_mp { .api }

852

```python

853

from sklearn.linear_model import orthogonal_mp

854

855

orthogonal_mp(

856

X: ArrayLike,

857

y: ArrayLike,

858

n_nonzero_coefs: int | None = None,

859

tol: float | None = None,

860

precompute: bool = False,

861

copy_X: bool = True,

862

return_path: bool = False,

863

return_n_iter: bool = False

864

) -> ArrayLike | tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, int] | tuple[ArrayLike, ArrayLike, int]

865

```

866

Orthogonal Matching Pursuit (OMP).

867

868

#### orthogonal_mp_gram { .api }

869

```python

870

from sklearn.linear_model import orthogonal_mp_gram

871

872

orthogonal_mp_gram(

873

Gram: ArrayLike,

874

Xy: ArrayLike,

875

n_nonzero_coefs: int | None = None,

876

tol: float | None = None,

877

norms_squared: ArrayLike | None = None,

878

copy_Gram: bool = True,

879

copy_Xy: bool = True,

880

return_path: bool = False,

881

return_n_iter: bool = False

882

) -> ArrayLike | tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, int] | tuple[ArrayLike, ArrayLike, int]

883

```

884

Gram Orthogonal Matching Pursuit (OMP).

885

886

## Support Vector Machines

887

888

### Classes

889

890

#### SVC { .api }

891

```python

892

from sklearn.svm import SVC

893

894

SVC(

895

C: float = 1.0,

896

kernel: str | Callable = "rbf",

897

degree: int = 3,

898

gamma: str | float = "scale",

899

coef0: float = 0.0,

900

shrinking: bool = True,

901

probability: bool = False,

902

tol: float = 0.001,

903

cache_size: float = 200,

904

class_weight: dict | str | None = None,

905

verbose: bool = False,

906

max_iter: int = -1,

907

decision_function_shape: str = "ovr",

908

break_ties: bool = False,

909

random_state: int | RandomState | None = None

910

)

911

```

912

C-Support Vector Classification.

913

914

#### NuSVC { .api }

915

```python

916

from sklearn.svm import NuSVC

917

918

NuSVC(

919

nu: float = 0.5,

920

kernel: str | Callable = "rbf",

921

degree: int = 3,

922

gamma: str | float = "scale",

923

coef0: float = 0.0,

924

shrinking: bool = True,

925

probability: bool = False,

926

tol: float = 0.001,

927

cache_size: float = 200,

928

class_weight: dict | str | None = None,

929

verbose: bool = False,

930

max_iter: int = -1,

931

decision_function_shape: str = "ovr",

932

break_ties: bool = False,

933

random_state: int | RandomState | None = None

934

)

935

```

936

Nu-Support Vector Classification.

937

938

#### LinearSVC { .api }

939

```python

940

from sklearn.svm import LinearSVC

941

942

LinearSVC(

943

penalty: str = "l2",

944

loss: str = "squared_hinge",

945

dual: bool = "auto",

946

tol: float = 0.0001,

947

C: float = 1.0,

948

multi_class: str = "ovr",

949

fit_intercept: bool = True,

950

intercept_scaling: float = 1,

951

class_weight: dict | str | None = None,

952

verbose: int = 0,

953

random_state: int | RandomState | None = None,

954

max_iter: int = 1000

955

)

956

```

957

Linear Support Vector Classification.

958

959

#### SVR { .api }

960

```python

961

from sklearn.svm import SVR

962

963

SVR(

964

kernel: str | Callable = "rbf",

965

degree: int = 3,

966

gamma: str | float = "scale",

967

coef0: float = 0.0,

968

tol: float = 0.001,

969

C: float = 1.0,

970

epsilon: float = 0.1,

971

shrinking: bool = True,

972

cache_size: float = 200,

973

verbose: bool = False,

974

max_iter: int = -1

975

)

976

```

977

Epsilon-Support Vector Regression.

978

979

#### NuSVR { .api }

980

```python

981

from sklearn.svm import NuSVR

982

983

NuSVR(

984

nu: float = 0.5,

985

C: float = 1.0,

986

kernel: str | Callable = "rbf",

987

degree: int = 3,

988

gamma: str | float = "scale",

989

coef0: float = 0.0,

990

shrinking: bool = True,

991

tol: float = 0.001,

992

cache_size: float = 200,

993

verbose: bool = False,

994

max_iter: int = -1

995

)

996

```

997

Nu Support Vector Regression.

998

999

#### LinearSVR { .api }

1000

```python

1001

from sklearn.svm import LinearSVR

1002

1003

LinearSVR(

1004

epsilon: float = 0.0,

1005

tol: float = 0.0001,

1006

C: float = 1.0,

1007

loss: str = "epsilon_insensitive",

1008

fit_intercept: bool = True,

1009

intercept_scaling: float = 1.0,

1010

dual: bool = "auto",

1011

verbose: int = 0,

1012

random_state: int | RandomState | None = None,

1013

max_iter: int = 1000

1014

)

1015

```

1016

Linear Support Vector Regression.

1017

1018

#### OneClassSVM { .api }

1019

```python

1020

from sklearn.svm import OneClassSVM

1021

1022

OneClassSVM(

1023

kernel: str | Callable = "rbf",

1024

degree: int = 3,

1025

gamma: str | float = "scale",

1026

coef0: float = 0.0,

1027

tol: float = 0.001,

1028

nu: float = 0.5,

1029

shrinking: bool = True,

1030

cache_size: float = 200,

1031

verbose: bool = False,

1032

max_iter: int = -1

1033

)

1034

```

1035

Unsupervised Outlier Detection.

1036

1037

### Functions

1038

1039

#### l1_min_c { .api }

1040

```python

1041

from sklearn.svm import l1_min_c

1042

1043

l1_min_c(

1044

X: ArrayLike,

1045

y: ArrayLike,

1046

loss: str = "squared_hinge",

1047

fit_intercept: bool = True,

1048

intercept_scaling: float = 1.0

1049

) -> float

1050

```

1051

Return the lowest bound for C.

1052

1053

## Decision Trees

1054

1055

#### DecisionTreeClassifier { .api }

1056

```python

1057

from sklearn.tree import DecisionTreeClassifier

1058

1059

DecisionTreeClassifier(

1060

criterion: str = "gini",

1061

splitter: str = "best",

1062

max_depth: int | None = None,

1063

min_samples_split: int | float = 2,

1064

min_samples_leaf: int | float = 1,

1065

min_weight_fraction_leaf: float = 0.0,

1066

max_features: int | float | str | None = None,

1067

random_state: int | RandomState | None = None,

1068

max_leaf_nodes: int | None = None,

1069

min_impurity_decrease: float = 0.0,

1070

class_weight: dict | list[dict] | str | None = None,

1071

ccp_alpha: float = 0.0,

1072

monotonic_cst: ArrayLike | None = None

1073

)

1074

```

1075

A decision tree classifier.

1076

1077

#### DecisionTreeRegressor { .api }

1078

```python

1079

from sklearn.tree import DecisionTreeRegressor

1080

1081

DecisionTreeRegressor(

1082

criterion: str = "squared_error",

1083

splitter: str = "best",

1084

max_depth: int | None = None,

1085

min_samples_split: int | float = 2,

1086

min_samples_leaf: int | float = 1,

1087

min_weight_fraction_leaf: float = 0.0,

1088

max_features: int | float | str | None = None,

1089

random_state: int | RandomState | None = None,

1090

max_leaf_nodes: int | None = None,

1091

min_impurity_decrease: float = 0.0,

1092

ccp_alpha: float = 0.0,

1093

monotonic_cst: ArrayLike | None = None

1094

)

1095

```

1096

A decision tree regressor.

1097

1098

#### ExtraTreeClassifier { .api }

1099

```python

1100

from sklearn.tree import ExtraTreeClassifier

1101

1102

ExtraTreeClassifier(

1103

criterion: str = "gini",

1104

splitter: str = "random",

1105

max_depth: int | None = None,

1106

min_samples_split: int | float = 2,

1107

min_samples_leaf: int | float = 1,

1108

min_weight_fraction_leaf: float = 0.0,

1109

max_features: int | float | str | None = "sqrt",

1110

random_state: int | RandomState | None = None,

1111

max_leaf_nodes: int | None = None,

1112

min_impurity_decrease: float = 0.0,

1113

class_weight: dict | list[dict] | str | None = None,

1114

ccp_alpha: float = 0.0

1115

)

1116

```

1117

An extremely randomized tree classifier.

1118

1119

#### ExtraTreeRegressor { .api }

1120

```python

1121

from sklearn.tree import ExtraTreeRegressor

1122

1123

ExtraTreeRegressor(

1124

criterion: str = "squared_error",

1125

splitter: str = "random",

1126

max_depth: int | None = None,

1127

min_samples_split: int | float = 2,

1128

min_samples_leaf: int | float = 1,

1129

min_weight_fraction_leaf: float = 0.0,

1130

max_features: int | float | str | None = 1.0,

1131

random_state: int | RandomState | None = None,

1132

max_leaf_nodes: int | None = None,

1133

min_impurity_decrease: float = 0.0,

1134

ccp_alpha: float = 0.0

1135

)

1136

```

1137

An extremely randomized tree regressor.

1138

1139

#### BaseDecisionTree { .api }

1140

```python

1141

from sklearn.tree import BaseDecisionTree

1142

1143

BaseDecisionTree(

1144

criterion: str,

1145

splitter: str,

1146

max_depth: int | None,

1147

min_samples_split: int | float,

1148

min_samples_leaf: int | float,

1149

min_weight_fraction_leaf: float,

1150

max_features: int | float | str | None,

1151

max_leaf_nodes: int | None,

1152

random_state: int | RandomState | None,

1153

min_impurity_decrease: float,

1154

class_weight: dict | list[dict] | str | None = None,

1155

ccp_alpha: float = 0.0

1156

)

1157

```

1158

Base class for decision trees.

1159

1160

### Decision Tree Functions

1161

1162

#### export_graphviz { .api }

1163

```python

1164

from sklearn.tree import export_graphviz

1165

1166

export_graphviz(

1167

decision_tree: BaseDecisionTree,

1168

out_file: str | None = None,

1169

max_depth: int | None = None,

1170

feature_names: ArrayLike | None = None,

1171

class_names: ArrayLike | bool | None = None,

1172

label: str = "all",

1173

filled: bool = False,

1174

leaves_parallel: bool = False,

1175

impurity: bool = True,

1176

node_ids: bool = False,

1177

proportion: bool = False,

1178

rotate: bool = False,

1179

rounded: bool = False,

1180

special_characters: bool = False,

1181

precision: int = 3,

1182

fontname: str = "helvetica"

1183

) -> str | None

1184

```

1185

Export a decision tree in DOT format.

1186

1187

#### export_text { .api }

1188

```python

1189

from sklearn.tree import export_text

1190

1191

export_text(

1192

decision_tree: BaseDecisionTree,

1193

feature_names: ArrayLike | None = None,

1194

max_depth: int | None = 10,

1195

spacing: int = 3,

1196

decimals: int = 2,

1197

show_weights: bool = False

1198

) -> str

1199

```

1200

Build a text report showing the rules of a decision tree.

1201

1202

#### plot_tree { .api }

1203

```python

1204

from sklearn.tree import plot_tree

1205

1206

plot_tree(

1207

decision_tree: BaseDecisionTree,

1208

max_depth: int | None = None,

1209

feature_names: ArrayLike | None = None,

1210

class_names: ArrayLike | None = None,

1211

label: str = "all",

1212

filled: bool = False,

1213

impurity: bool = True,

1214

node_ids: bool = False,

1215

proportion: bool = False,

1216

rotate: bool = False,

1217

rounded: bool = False,

1218

precision: int = 3,

1219

ax: Axes | None = None,

1220

fontsize: int | None = None

1221

) -> list[Annotation]

1222

```

1223

Plot a decision tree.

1224

1225

## Ensemble Methods

1226

1227

#### RandomForestClassifier { .api }

1228

```python

1229

from sklearn.ensemble import RandomForestClassifier

1230

1231

RandomForestClassifier(

1232

n_estimators: int = 100,

1233

criterion: str = "gini",

1234

max_depth: int | None = None,

1235

min_samples_split: int | float = 2,

1236

min_samples_leaf: int | float = 1,

1237

min_weight_fraction_leaf: float = 0.0,

1238

max_features: int | float | str | None = "sqrt",

1239

max_leaf_nodes: int | None = None,

1240

min_impurity_decrease: float = 0.0,

1241

bootstrap: bool = True,

1242

oob_score: bool = False,

1243

n_jobs: int | None = None,

1244

random_state: int | RandomState | None = None,

1245

verbose: int = 0,

1246

warm_start: bool = False,

1247

class_weight: dict | list[dict] | str | None = None,

1248

ccp_alpha: float = 0.0,

1249

max_samples: int | float | None = None,

1250

monotonic_cst: ArrayLike | None = None

1251

)

1252

```

1253

A random forest classifier.

1254

1255

#### RandomForestRegressor { .api }

1256

```python

1257

from sklearn.ensemble import RandomForestRegressor

1258

1259

RandomForestRegressor(

1260

n_estimators: int = 100,

1261

criterion: str = "squared_error",

1262

max_depth: int | None = None,

1263

min_samples_split: int | float = 2,

1264

min_samples_leaf: int | float = 1,

1265

min_weight_fraction_leaf: float = 0.0,

1266

max_features: int | float | str | None = 1.0,

1267

max_leaf_nodes: int | None = None,

1268

min_impurity_decrease: float = 0.0,

1269

bootstrap: bool = True,

1270

oob_score: bool = False,

1271

n_jobs: int | None = None,

1272

random_state: int | RandomState | None = None,

1273

verbose: int = 0,

1274

warm_start: bool = False,

1275

ccp_alpha: float = 0.0,

1276

max_samples: int | float | None = None,

1277

monotonic_cst: ArrayLike | None = None

1278

)

1279

```

1280

A random forest regressor.

1281

1282

#### ExtraTreesClassifier { .api }

1283

```python

1284

from sklearn.ensemble import ExtraTreesClassifier

1285

1286

ExtraTreesClassifier(

1287

n_estimators: int = 100,

1288

criterion: str = "gini",

1289

max_depth: int | None = None,

1290

min_samples_split: int | float = 2,

1291

min_samples_leaf: int | float = 1,

1292

min_weight_fraction_leaf: float = 0.0,

1293

max_features: int | float | str | None = "sqrt",

1294

max_leaf_nodes: int | None = None,

1295

min_impurity_decrease: float = 0.0,

1296

bootstrap: bool = False,

1297

oob_score: bool = False,

1298

n_jobs: int | None = None,

1299

random_state: int | RandomState | None = None,

1300

verbose: int = 0,

1301

warm_start: bool = False,

1302

class_weight: dict | list[dict] | str | None = None,

1303

ccp_alpha: float = 0.0,

1304

max_samples: int | float | None = None,

1305

monotonic_cst: ArrayLike | None = None

1306

)

1307

```

1308

An extra-trees classifier.

1309

1310

#### ExtraTreesRegressor { .api }

1311

```python

1312

from sklearn.ensemble import ExtraTreesRegressor

1313

1314

ExtraTreesRegressor(

1315

n_estimators: int = 100,

1316

criterion: str = "squared_error",

1317

max_depth: int | None = None,

1318

min_samples_split: int | float = 2,

1319

min_samples_leaf: int | float = 1,

1320

min_weight_fraction_leaf: float = 0.0,

1321

max_features: int | float | str | None = 1.0,

1322

max_leaf_nodes: int | None = None,

1323

min_impurity_decrease: float = 0.0,

1324

bootstrap: bool = False,

1325

oob_score: bool = False,

1326

n_jobs: int | None = None,

1327

random_state: int | RandomState | None = None,

1328

verbose: int = 0,

1329

warm_start: bool = False,

1330

ccp_alpha: float = 0.0,

1331

max_samples: int | float | None = None,

1332

monotonic_cst: ArrayLike | None = None

1333

)

1334

```

1335

An extra-trees regressor.

1336

1337

#### GradientBoostingClassifier { .api }

1338

```python

1339

from sklearn.ensemble import GradientBoostingClassifier

1340

1341

GradientBoostingClassifier(

1342

loss: str = "log_loss",

1343

learning_rate: float = 0.1,

1344

n_estimators: int = 100,

1345

subsample: float = 1.0,

1346

criterion: str = "friedman_mse",

1347

min_samples_split: int | float = 2,

1348

min_samples_leaf: int | float = 1,

1349

min_weight_fraction_leaf: float = 0.0,

1350

max_depth: int = 3,

1351

min_impurity_decrease: float = 0.0,

1352

init: BaseClassifier | str | None = None,

1353

random_state: int | RandomState | None = None,

1354

max_features: int | float | str | None = None,

1355

alpha: float = 0.9,

1356

verbose: int = 0,

1357

max_leaf_nodes: int | None = None,

1358

warm_start: bool = False,

1359

validation_fraction: float = 0.1,

1360

n_iter_no_change: int | None = None,

1361

tol: float = 0.0001,

1362

ccp_alpha: float = 0.0

1363

)

1364

```

1365

Gradient Boosting for classification.

1366

1367

#### GradientBoostingRegressor { .api }

1368

```python

1369

from sklearn.ensemble import GradientBoostingRegressor

1370

1371

GradientBoostingRegressor(

1372

loss: str = "squared_error",

1373

learning_rate: float = 0.1,

1374

n_estimators: int = 100,

1375

subsample: float = 1.0,

1376

criterion: str = "friedman_mse",

1377

min_samples_split: int | float = 2,

1378

min_samples_leaf: int | float = 1,

1379

min_weight_fraction_leaf: float = 0.0,

1380

max_depth: int = 3,

1381

min_impurity_decrease: float = 0.0,

1382

init: BaseRegressor | str | None = None,

1383

random_state: int | RandomState | None = None,

1384

max_features: int | float | str | None = None,

1385

alpha: float = 0.9,

1386

verbose: int = 0,

1387

max_leaf_nodes: int | None = None,

1388

warm_start: bool = False,

1389

validation_fraction: float = 0.1,

1390

n_iter_no_change: int | None = None,

1391

tol: float = 0.0001,

1392

ccp_alpha: float = 0.0

1393

)

1394

```

1395

Gradient Boosting for regression.

1396

1397

#### HistGradientBoostingClassifier { .api }

1398

```python

1399

from sklearn.ensemble import HistGradientBoostingClassifier

1400

1401

HistGradientBoostingClassifier(

1402

loss: str = "log_loss",

1403

learning_rate: float = 0.1,

1404

max_iter: int = 100,

1405

max_leaf_nodes: int = 31,

1406

max_depth: int | None = None,

1407

min_samples_leaf: int = 20,

1408

l2_regularization: float = 0.0,

1409

max_features: float = 1.0,

1410

max_bins: int = 255,

1411

categorical_features: ArrayLike | str | None = None,

1412

monotonic_cst: ArrayLike | dict | None = None,

1413

interaction_cst: ArrayLike | str | None = None,

1414

warm_start: bool = False,

1415

early_stopping: str | bool = "auto",

1416

scoring: str | Callable | None = "loss",

1417

validation_fraction: int | float | None = 0.1,

1418

n_iter_no_change: int = 10,

1419

tol: float = 1e-07,

1420

verbose: int = 0,

1421

random_state: int | RandomState | None = None,

1422

class_weight: dict | str | None = None

1423

)

1424

```

1425

Histogram-based Gradient Boosting Classification Tree.

1426

1427

#### HistGradientBoostingRegressor { .api }

1428

```python

1429

from sklearn.ensemble import HistGradientBoostingRegressor

1430

1431

HistGradientBoostingRegressor(

1432

loss: str = "squared_error",

1433

quantile: float | None = None,

1434

learning_rate: float = 0.1,

1435

max_iter: int = 100,

1436

max_leaf_nodes: int = 31,

1437

max_depth: int | None = None,

1438

min_samples_leaf: int = 20,

1439

l2_regularization: float = 0.0,

1440

max_features: float = 1.0,

1441

max_bins: int = 255,

1442

categorical_features: ArrayLike | str | None = None,

1443

monotonic_cst: ArrayLike | dict | None = None,

1444

interaction_cst: ArrayLike | str | None = None,

1445

warm_start: bool = False,

1446

early_stopping: str | bool = "auto",

1447

scoring: str | Callable | None = "loss",

1448

validation_fraction: int | float | None = 0.1,

1449

n_iter_no_change: int = 10,

1450

tol: float = 1e-07,

1451

verbose: int = 0,

1452

random_state: int | RandomState | None = None

1453

)

1454

```

1455

Histogram-based Gradient Boosting Regression Tree.

1456

1457

#### AdaBoostClassifier { .api }

1458

```python

1459

from sklearn.ensemble import AdaBoostClassifier

1460

1461

AdaBoostClassifier(

1462

estimator: object | None = None,

1463

n_estimators: int = 50,

1464

learning_rate: float = 1.0,

1465

algorithm: str = "SAMME.R",

1466

random_state: int | RandomState | None = None,

1467

base_estimator: object = "deprecated"

1468

)

1469

```

1470

An AdaBoost classifier.

1471

1472

#### AdaBoostRegressor { .api }

1473

```python

1474

from sklearn.ensemble import AdaBoostRegressor

1475

1476

AdaBoostRegressor(

1477

estimator: object | None = None,

1478

n_estimators: int = 50,

1479

learning_rate: float = 1.0,

1480

loss: str = "linear",

1481

random_state: int | RandomState | None = None,

1482

base_estimator: object = "deprecated"

1483

)

1484

```

1485

An AdaBoost regressor.

1486

1487

#### BaggingClassifier { .api }

1488

```python

1489

from sklearn.ensemble import BaggingClassifier

1490

1491

BaggingClassifier(

1492

estimator: object | None = None,

1493

n_estimators: int = 10,

1494

max_samples: int | float = 1.0,

1495

max_features: int | float = 1.0,

1496

bootstrap: bool = True,

1497

bootstrap_features: bool = False,

1498

oob_score: bool = False,

1499

warm_start: bool = False,

1500

n_jobs: int | None = None,

1501

random_state: int | RandomState | None = None,

1502

verbose: int = 0,

1503

base_estimator: object = "deprecated"

1504

)

1505

```

1506

A Bagging classifier.

1507

1508

#### BaggingRegressor { .api }

1509

```python

1510

from sklearn.ensemble import BaggingRegressor

1511

1512

BaggingRegressor(

1513

estimator: object | None = None,

1514

n_estimators: int = 10,

1515

max_samples: int | float = 1.0,

1516

max_features: int | float = 1.0,

1517

bootstrap: bool = True,

1518

bootstrap_features: bool = False,

1519

oob_score: bool = False,

1520

warm_start: bool = False,

1521

n_jobs: int | None = None,

1522

random_state: int | RandomState | None = None,

1523

verbose: int = 0,

1524

base_estimator: object = "deprecated"

1525

)

1526

```

1527

A Bagging regressor.

1528

1529

#### VotingClassifier { .api }

1530

```python

1531

from sklearn.ensemble import VotingClassifier

1532

1533

VotingClassifier(

1534

estimators: list[tuple[str, BaseEstimator]],

1535

voting: str = "hard",

1536

weights: ArrayLike | None = None,

1537

n_jobs: int | None = None,

1538

flatten_transform: bool = True,

1539

verbose: bool = False

1540

)

1541

```

1542

Soft Voting/Majority Rule classifier for unfitted estimators.

1543

1544

#### VotingRegressor { .api }

1545

```python

1546

from sklearn.ensemble import VotingRegressor

1547

1548

VotingRegressor(

1549

estimators: list[tuple[str, BaseEstimator]],

1550

weights: ArrayLike | None = None,

1551

n_jobs: int | None = None,

1552

verbose: bool = False

1553

)

1554

```

1555

Prediction voting regressor for unfitted estimators.

1556

1557

#### StackingClassifier { .api }

1558

```python

1559

from sklearn.ensemble import StackingClassifier

1560

1561

StackingClassifier(

1562

estimators: list[tuple[str, BaseEstimator]],

1563

final_estimator: BaseClassifier | None = None,

1564

cv: int | BaseCrossValidator | Iterable | str | None = None,

1565

stack_method: str = "auto",

1566

n_jobs: int | None = None,

1567

passthrough: bool = False,

1568

verbose: int = 0

1569

)

1570

```

1571

Stack of estimators with a final classifier.

1572

1573

#### StackingRegressor { .api }

1574

```python

1575

from sklearn.ensemble import StackingRegressor

1576

1577

StackingRegressor(

1578

estimators: list[tuple[str, BaseEstimator]],

1579

final_estimator: BaseRegressor | None = None,

1580

cv: int | BaseCrossValidator | Iterable | str | None = None,

1581

n_jobs: int | None = None,

1582

passthrough: bool = False,

1583

verbose: int = 0

1584

)

1585

```

1586

Stack of estimators with a final regressor.

1587

1588

#### IsolationForest { .api }

1589

```python

1590

from sklearn.ensemble import IsolationForest

1591

1592

IsolationForest(

1593

n_estimators: int = 100,

1594

max_samples: int | float | str = "auto",

1595

contamination: float | str = "auto",

1596

max_features: int | float = 1.0,

1597

bootstrap: bool = False,

1598

n_jobs: int | None = None,

1599

random_state: int | RandomState | None = None,

1600

verbose: int = 0,

1601

warm_start: bool = False

1602

)

1603

```

1604

Isolation Forest Algorithm.

1605

1606

#### RandomTreesEmbedding { .api }

1607

```python

1608

from sklearn.ensemble import RandomTreesEmbedding

1609

1610

RandomTreesEmbedding(

1611

n_estimators: int = 100,

1612

max_depth: int = 5,

1613

min_samples_split: int | float = 2,

1614

min_samples_leaf: int | float = 1,

1615

min_weight_fraction_leaf: float = 0.0,

1616

max_leaf_nodes: int | None = None,

1617

min_impurity_decrease: float = 0.0,

1618

sparse_output: bool = True,

1619

n_jobs: int | None = None,

1620

random_state: int | RandomState | None = None,

1621

verbose: int = 0,

1622

warm_start: bool = False

1623

)

1624

```

1625

An ensemble of totally random trees.

1626

1627

#### BaseEnsemble { .api }

1628

```python

1629

from sklearn.ensemble import BaseEnsemble

1630

1631

BaseEnsemble(

1632

estimator: object | None,

1633

n_estimators: int = 10,

1634

estimator_params: tuple = ()

1635

)

1636

```

1637

Base class for all ensemble classes.

1638

1639

## Naive Bayes

1640

1641

#### GaussianNB { .api }

1642

```python

1643

from sklearn.naive_bayes import GaussianNB

1644

1645

GaussianNB(

1646

priors: ArrayLike | None = None,

1647

var_smoothing: float = 1e-09

1648

)

1649

```

1650

Gaussian Naive Bayes (GaussianNB).

1651

1652

#### MultinomialNB { .api }

1653

```python

1654

from sklearn.naive_bayes import MultinomialNB

1655

1656

MultinomialNB(

1657

alpha: float | ArrayLike = 1.0,

1658

force_alpha: bool = False,

1659

fit_prior: bool = True,

1660

class_prior: ArrayLike | None = None

1661

)

1662

```

1663

Naive Bayes classifier for multinomial models.

1664

1665

#### ComplementNB { .api }

1666

```python

1667

from sklearn.naive_bayes import ComplementNB

1668

1669

ComplementNB(

1670

alpha: float | ArrayLike = 1.0,

1671

force_alpha: bool = False,

1672

fit_prior: bool = True,

1673

class_prior: ArrayLike | None = None,

1674

norm: bool = False

1675

)

1676

```

1677

The Complement Naive Bayes classifier described in Rennie et al. (2003).

1678

1679

#### BernoulliNB { .api }

1680

```python

1681

from sklearn.naive_bayes import BernoulliNB

1682

1683

BernoulliNB(

1684

alpha: float | ArrayLike = 1.0,

1685

force_alpha: bool = False,

1686

binarize: float | None = 0.0,

1687

fit_prior: bool = True,

1688

class_prior: ArrayLike | None = None

1689

)

1690

```

1691

Naive Bayes classifier for multivariate Bernoulli models.

1692

1693

#### CategoricalNB { .api }

1694

```python

1695

from sklearn.naive_bayes import CategoricalNB

1696

1697

CategoricalNB(

1698

alpha: float | ArrayLike = 1.0,

1699

force_alpha: bool = False,

1700

fit_prior: bool = True,

1701

class_prior: ArrayLike | None = None,

1702

min_categories: int | ArrayLike | None = None

1703

)

1704

```

1705

Naive Bayes classifier for categorical features.

1706

1707

## k-Nearest Neighbors

1708

1709

#### KNeighborsClassifier { .api }

1710

```python

1711

from sklearn.neighbors import KNeighborsClassifier

1712

1713

KNeighborsClassifier(

1714

n_neighbors: int = 5,

1715

weights: str | Callable = "uniform",

1716

algorithm: str = "auto",

1717

leaf_size: int = 30,

1718

p: int | float = 2,

1719

metric: str | Callable = "minkowski",

1720

metric_params: dict | None = None,

1721

n_jobs: int | None = None

1722

)

1723

```

1724

Classifier implementing the k-nearest neighbors vote.

1725

1726

#### KNeighborsRegressor { .api }

1727

```python

1728

from sklearn.neighbors import KNeighborsRegressor

1729

1730

KNeighborsRegressor(

1731

n_neighbors: int = 5,

1732

weights: str | Callable = "uniform",

1733

algorithm: str = "auto",

1734

leaf_size: int = 30,

1735

p: int | float = 2,

1736

metric: str | Callable = "minkowski",

1737

metric_params: dict | None = None,

1738

n_jobs: int | None = None

1739

)

1740

```

1741

Regression based on k-nearest neighbors.

1742

1743

#### RadiusNeighborsClassifier { .api }

1744

```python

1745

from sklearn.neighbors import RadiusNeighborsClassifier

1746

1747

RadiusNeighborsClassifier(

1748

radius: float = 1.0,

1749

weights: str | Callable = "uniform",

1750

algorithm: str = "auto",

1751

leaf_size: int = 30,

1752

p: int | float = 2,

1753

metric: str | Callable = "minkowski",

1754

outlier_label: int | str | ArrayLike | None = None,

1755

metric_params: dict | None = None,

1756

n_jobs: int | None = None

1757

)

1758

```

1759

Classifier implementing a vote among neighbors within a radius.

1760

1761

#### RadiusNeighborsRegressor { .api }

1762

```python

1763

from sklearn.neighbors import RadiusNeighborsRegressor

1764

1765

RadiusNeighborsRegressor(

1766

radius: float = 1.0,

1767

weights: str | Callable = "uniform",

1768

algorithm: str = "auto",

1769

leaf_size: int = 30,

1770

p: int | float = 2,

1771

metric: str | Callable = "minkowski",

1772

metric_params: dict | None = None,

1773

n_jobs: int | None = None

1774

)

1775

```

1776

Regression based on neighbors within a fixed radius.

1777

1778

#### NearestCentroid { .api }

1779

```python

1780

from sklearn.neighbors import NearestCentroid

1781

1782

NearestCentroid(

1783

metric: str | Callable = "euclidean",

1784

shrink_threshold: float | None = None

1785

)

1786

```

1787

Nearest centroid classifier.

1788

1789

## Neural Networks

1790

1791

#### MLPClassifier { .api }

1792

```python

1793

from sklearn.neural_network import MLPClassifier

1794

1795

MLPClassifier(

1796

hidden_layer_sizes: tuple = (100,),

1797

activation: str = "relu",

1798

solver: str = "adam",

1799

alpha: float = 0.0001,

1800

batch_size: int | str = "auto",

1801

learning_rate: str = "constant",

1802

learning_rate_init: float = 0.001,

1803

power_t: float = 0.5,

1804

max_iter: int = 200,

1805

shuffle: bool = True,

1806

random_state: int | RandomState | None = None,

1807

tol: float = 0.0001,

1808

verbose: bool = False,

1809

warm_start: bool = False,

1810

momentum: float = 0.9,

1811

nesterovs_momentum: bool = True,

1812

early_stopping: bool = False,

1813

validation_fraction: float = 0.1,

1814

beta_1: float = 0.9,

1815

beta_2: float = 0.999,

1816

epsilon: float = 1e-08,

1817

n_iter_no_change: int = 10,

1818

max_fun: int = 15000

1819

)

1820

```

1821

Multi-layer Perceptron classifier.

1822

1823

#### MLPRegressor { .api }

1824

```python

1825

from sklearn.neural_network import MLPRegressor

1826

1827

MLPRegressor(

1828

hidden_layer_sizes: tuple = (100,),

1829

activation: str = "relu",

1830

solver: str = "adam",

1831

alpha: float = 0.0001,

1832

batch_size: int | str = "auto",

1833

learning_rate: str = "constant",

1834

learning_rate_init: float = 0.001,

1835

power_t: float = 0.5,

1836

max_iter: int = 200,

1837

shuffle: bool = True,

1838

random_state: int | RandomState | None = None,

1839

tol: float = 0.0001,

1840

verbose: bool = False,

1841

warm_start: bool = False,

1842

momentum: float = 0.9,

1843

nesterovs_momentum: bool = True,

1844

early_stopping: bool = False,

1845

validation_fraction: float = 0.1,

1846

beta_1: float = 0.9,

1847

beta_2: float = 0.999,

1848

epsilon: float = 1e-08,

1849

n_iter_no_change: int = 10,

1850

max_fun: int = 15000

1851

)

1852

```

1853

Multi-layer Perceptron regressor.

1854

1855

#### BernoulliRBM { .api }

1856

```python

1857

from sklearn.neural_network import BernoulliRBM

1858

1859

BernoulliRBM(

1860

n_components: int = 256,

1861

learning_rate: float = 0.1,

1862

batch_size: int = 10,

1863

n_iter: int = 10,

1864

verbose: int = 0,

1865

random_state: int | RandomState | None = None

1866

)

1867

```

1868

Bernoulli Restricted Boltzmann Machine (RBM).

1869

1870

## Discriminant Analysis

1871

1872

#### LinearDiscriminantAnalysis { .api }

1873

```python

1874

from sklearn.discriminant_analysis import LinearDiscriminantAnalysis

1875

1876

LinearDiscriminantAnalysis(

1877

solver: str = "svd",

1878

shrinkage: str | float | None = None,

1879

priors: ArrayLike | None = None,

1880

n_components: int | None = None,

1881

store_covariance: bool = False,

1882

tol: float = 0.0001,

1883

covariance_estimator: BaseEstimator | None = None

1884

)

1885

```

1886

Linear Discriminant Analysis.

1887

1888

#### QuadraticDiscriminantAnalysis { .api }

1889

```python

1890

from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis

1891

1892

QuadraticDiscriminantAnalysis(

1893

priors: ArrayLike | None = None,

1894

reg_param: float = 0.0,

1895

store_covariance: bool = False,

1896

tol: float = 0.0001

1897

)

1898

```

1899

Quadratic Discriminant Analysis.

1900

1901

## Gaussian Processes

1902

1903

#### GaussianProcessClassifier { .api }

1904

```python

1905

from sklearn.gaussian_process import GaussianProcessClassifier

1906

1907

GaussianProcessClassifier(

1908

kernel: Kernel | None = None,

1909

optimizer: str | Callable | None = "fmin_l_bfgs_b",

1910

n_restarts_optimizer: int = 0,

1911

max_iter_predict: int = 100,

1912

warm_start: bool = False,

1913

copy_X_train: bool = True,

1914

random_state: int | RandomState | None = None,

1915

multi_class: str = "one_vs_rest",

1916

n_jobs: int | None = None

1917

)

1918

```

1919

Gaussian process classification (GPC) based on Laplace approximation.

1920

1921

#### GaussianProcessRegressor { .api }

1922

```python

1923

from sklearn.gaussian_process import GaussianProcessRegressor

1924

1925

GaussianProcessRegressor(

1926

kernel: Kernel | None = None,

1927

alpha: float | ArrayLike = 1e-10,

1928

optimizer: str | Callable | None = "fmin_l_bfgs_b",

1929

n_restarts_optimizer: int = 0,

1930

normalize_y: bool = False,

1931

copy_X_train: bool = True,

1932

n_targets: int | None = None,

1933

random_state: int | RandomState | None = None

1934

)

1935

```

1936

Gaussian process regression (GPR).

1937

1938

## Kernel Ridge Regression

1939

1940

#### KernelRidge { .api }

1941

```python

1942

from sklearn.kernel_ridge import KernelRidge

1943

1944

KernelRidge(

1945

alpha: float | ArrayLike = 1,

1946

kernel: str | Callable = "linear",

1947

gamma: float | None = None,

1948

degree: float = 3,

1949

coef0: float = 1,

1950

kernel_params: dict | None = None

1951

)

1952

```

1953

Kernel ridge regression.

1954

1955

## Isotonic Regression

1956

1957

#### IsotonicRegression { .api }

1958

```python

1959

from sklearn.isotonic import IsotonicRegression

1960

1961

IsotonicRegression(

1962

y_min: float | None = None,

1963

y_max: float | None = None,

1964

increasing: bool | str = True,

1965

out_of_bounds: str = "nan"

1966

)

1967

```

1968

Isotonic regression model.

1969

1970

## Multiclass and Multioutput

1971

1972

#### OneVsRestClassifier { .api }

1973

```python

1974

from sklearn.multiclass import OneVsRestClassifier

1975

1976

OneVsRestClassifier(

1977

estimator: BaseEstimator,

1978

n_jobs: int | None = None

1979

)

1980

```

1981

One-vs-the-rest (OvR) multiclass strategy.

1982

1983

#### OneVsOneClassifier { .api }

1984

```python

1985

from sklearn.multiclass import OneVsOneClassifier

1986

1987

OneVsOneClassifier(

1988

estimator: BaseEstimator,

1989

n_jobs: int | None = None

1990

)

1991

```

1992

One-vs-one multiclass strategy.

1993

1994

#### OutputCodeClassifier { .api }

1995

```python

1996

from sklearn.multiclass import OutputCodeClassifier

1997

1998

OutputCodeClassifier(

1999

estimator: BaseEstimator,

2000

code_size: float = 1.5,

2001

random_state: int | RandomState | None = None,

2002

n_jobs: int | None = None

2003

)

2004

```

2005

(Error-Correcting) Output-Code multiclass strategy.

2006

2007

#### MultiOutputClassifier { .api }

2008

```python

2009

from sklearn.multioutput import MultiOutputClassifier

2010

2011

MultiOutputClassifier(

2012

estimator: BaseEstimator,

2013

n_jobs: int | None = None

2014

)

2015

```

2016

Multi target classification.

2017

2018

#### MultiOutputRegressor { .api }

2019

```python

2020

from sklearn.multioutput import MultiOutputRegressor

2021

2022

MultiOutputRegressor(

2023

estimator: BaseEstimator,

2024

n_jobs: int | None = None

2025

)

2026

```

2027

Multi target regression.

2028

2029

#### ClassifierChain { .api }

2030

```python

2031

from sklearn.multioutput import ClassifierChain

2032

2033

ClassifierChain(

2034

base_estimator: BaseEstimator,

2035

order: ArrayLike | str | None = None,

2036

cv: int | BaseCrossValidator | Iterable | None = None,

2037

random_state: int | RandomState | None = None

2038

)

2039

```

2040

A multi-label model that arranges binary classifiers into a chain.

2041

2042

#### RegressorChain { .api }

2043

```python

2044

from sklearn.multioutput import RegressorChain

2045

2046

RegressorChain(

2047

base_estimator: BaseEstimator,

2048

order: ArrayLike | str | None = None,

2049

cv: int | BaseCrossValidator | Iterable | None = None,

2050

random_state: int | RandomState | None = None

2051

)

2052

```

2053

A multi-label model that arranges regressors into a chain.

2054

2055

## Semi-Supervised Learning

2056

2057

#### LabelPropagation { .api }

2058

```python

2059

from sklearn.semi_supervised import LabelPropagation

2060

2061

LabelPropagation(

2062

kernel: str | Callable = "rbf",

2063

gamma: float = 20,

2064

n_neighbors: int = 7,

2065

max_iter: int = 1000,

2066

tol: float = 0.001,

2067

n_jobs: int | None = None

2068

)

2069

```

2070

Label Propagation classifier.

2071

2072

#### LabelSpreading { .api }

2073

```python

2074

from sklearn.semi_supervised import LabelSpreading

2075

2076

LabelSpreading(

2077

kernel: str | Callable = "rbf",

2078

gamma: float = 20,

2079

n_neighbors: int = 7,

2080

alpha: float = 0.2,

2081

max_iter: int = 30,

2082

tol: float = 0.001,

2083

n_jobs: int | None = None

2084

)

2085

```

2086

LabelSpreading model for semi-supervised learning.

2087

2088

#### SelfTrainingClassifier { .api }

2089

```python

2090

from sklearn.semi_supervised import SelfTrainingClassifier

2091

2092

SelfTrainingClassifier(

2093

base_estimator: BaseEstimator,

2094

threshold: float = 0.75,

2095

criterion: str = "threshold",

2096

k_best: int = 10,

2097

max_iter: int | None = 10,

2098

verbose: bool = False

2099

)

2100

```

2101

Self-training classifier.

2102

2103

## Dummy Estimators

2104

2105

#### DummyClassifier { .api }

2106

```python

2107

from sklearn.dummy import DummyClassifier

2108

2109

DummyClassifier(

2110

strategy: str = "prior",

2111

random_state: int | RandomState | None = None,

2112

constant: int | str | ArrayLike | None = None

2113

)

2114

```

2115

DummyClassifier makes predictions that ignore the input features.

2116

2117

#### DummyRegressor { .api }

2118

```python

2119

from sklearn.dummy import DummyRegressor

2120

2121

DummyRegressor(

2122

strategy: str = "mean",

2123

constant: int | float | ArrayLike | None = None,

2124

quantile: float | None = None

2125

)

2126

```

2127

DummyRegressor makes predictions that ignore the input features.

2128

2129

## Calibration

2130

2131

#### CalibratedClassifierCV { .api }

2132

```python

2133

from sklearn.calibration import CalibratedClassifierCV

2134

2135

CalibratedClassifierCV(

2136

estimator: BaseClassifier | None = None,

2137

method: str = "sigmoid",

2138

cv: int | BaseCrossValidator | Iterable | str | None = None,

2139

n_jobs: int | None = None,

2140

ensemble: bool = True,

2141

base_estimator: BaseClassifier = "deprecated"

2142

)

2143

```

2144

Probability calibration with isotonic regression or logistic regression.