Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Scikit learn Scikit learn L1MinC

From Leeroopedia


Knowledge Sources
Domains Machine Learning, Support Vector Machines
Last Updated 2026-02-08 15:00 GMT

Overview

Concrete tool for computing the lowest bound for the regularization parameter C in L1-penalized classifiers, provided by scikit-learn.

Description

The l1_min_c function returns the lowest bound for the regularization parameter C such that for C in (l1_min_c, infinity) the model is guaranteed not to be empty. This applies to L1-penalized classifiers such as LinearSVC with penalty='l1' and LogisticRegression with l1_ratio=1. The computed value is valid when the class_weight parameter is not set.

Usage

Use this function before fitting an L1-penalized linear classifier to determine the minimum useful value of the C parameter, particularly when constructing regularization paths.

Code Reference

Source Location

Signature

@validate_params(...)
def l1_min_c(X, y, *, loss="squared_hinge", fit_intercept=True, intercept_scaling=1.0):

Import

from sklearn.svm import l1_min_c

I/O Contract

Inputs

Name Type Required Description
X array-like or sparse matrix of shape (n_samples, n_features) Yes Training feature matrix
y array-like of shape (n_samples,) Yes Target vector
loss str No Loss function: 'squared_hinge' or 'log' (default 'squared_hinge')
fit_intercept bool No Whether the intercept is fitted (default True)
intercept_scaling float No Scaling factor for synthetic intercept feature (default 1.0)

Outputs

Name Type Description
l1_min_c float The lowest bound for C guaranteeing a non-empty model

Usage Examples

Basic Usage

from sklearn.svm import l1_min_c
from sklearn.datasets import make_classification

X, y = make_classification(n_samples=100, n_features=20, random_state=0)
min_c = l1_min_c(X, y, loss="squared_hinge")
print(f"Minimum C value: {min_c:.6f}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment