ronantakizawa/codereview-bench huggingface dataset:
Repository: scikit-learn/scikit-learn
File: examples/model_selection/plot_confusion_matrix.py (Python)

Code before:
        X_test,
        y_test,
        display_labels=class_names,
        cmap=plt.cm.Blues,
        normalize=normalize,
    )
    disp.ax_.set_title(title)

    print(title)
    print(disp.confusion_matrix)

plt.show()

# %%
# Binary Classification
# =====================
#
# For binary problems, :func:`sklearn.metrics.confusion_matrix` has the ``ravel`` method
# we can use get counts of true negatives, false positives, false negatives and
# true positives.
#
# :func:`sklearn.metrics.binary_classification_curve`
# can be used to count true negatives, false positives, false negatives and true
# positives for different threshold values. It is fundamental for binary classification
# metrics like :func:`sklearn.metrics.roc_auc_score` and
# :func:`sklearn.metrics.det_curve`.

from sklearn.datasets import make_classification
from sklearn.metrics import binary_classification_curve

X, y = make_classification(
    n_samples=100,
    n_features=20,
    n_informative=20,
    n_redundant=0,
    n_classes=2,
    random_state=42,
)

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

classifier = svm.SVC(kernel="linear", C=0.01, probability=True)
classifier.fit(X_train, y_train)

y_score = classifier.predict_proba(X_test)[:, 1]

tns, fps, fns, tps, threshold = binary_classification_curve(y_test, y_score)

# Plot TNs, FPs, FNs and TPs vs Thresholds

Review comment (suggestion):
```suggestion
# metrics like :func:`~sklearn.metrics.roc_auc_score` and
# :func:`~sklearn.metrics.det_curve`.
```
nit

Code after:
        X_test,
        y_test,
        display_labels=class_names,
        cmap=plt.cm.Blues,
        normalize=normalize,
    )
    disp.ax_.set_title(title)

    print(title)
    print(disp.confusion_matrix)

plt.show()

# %%
# Binary Classification
# =====================
#
# For binary problems, :func:`sklearn.metrics.confusion_matrix` has the `ravel` method
# we can use get counts of true negatives, false positives, false negatives and
# true positives.
#
# To obtain true negatives, false positives, false negatives and true
# positives counts at different thresholds, one can use
# :func:`sklearn.metrics.confusion_matrix_at_thresholds`.
# This is fundamental for binary classification
# metrics like :func:`~sklearn.metrics.roc_auc_score` and
# :func:`~sklearn.metrics.det_curve`.

from sklearn.datasets import make_classification
from sklearn.metrics import confusion_matrix_at_thresholds

X, y = make_classification(
    n_samples=100,
    n_features=20,
    n_informative=20,
    n_redundant=0,
    n_classes=2,
    random_state=42,
)

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

classifier = svm.SVC(kernel="linear", C=0.01, probability=True)
classifier.fit(X_train, y_train)

y_score = classifier.predict_proba(X_test)[:, 1]

tns, fps, fns, tps, threshold = confusion_matrix_at_thresholds(y_test, y_score)
Repository: scikit-learn/scikit-learn
File: sklearn/gaussian_process/tests/test_gpc.py (Python)

Code before:
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

import warnings

import numpy as np
import pytest
import scipy

from sklearn.base import clone
from sklearn.exceptions import ConvergenceWarning
from sklearn.externals._packaging.version import parse as parse_version
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import (
    RBF,
    CompoundKernel,
    Product,
    WhiteKernel,
)
from sklearn.gaussian_process.kernels import (
    ConstantKernel as C,
)
from sklearn.gaussian_process.tests._mini_sequence_kernel import MiniSeqKernel
from sklearn.utils._testing import assert_almost_equal, assert_array_equal

sp_version = parse_version(scipy.__version__)
if not sp_version < parse_version("1.15.0"):
    from scipy.differentiate import derivative


def f(x):
    return np.sin(x)


X = np.atleast_2d(np.linspace(0, 10, 30)).T
X2 = np.atleast_2d([2.0, 4.0, 5.5, 6.5, 7.5]).T
y = np.array(f(X).ravel() > 0, dtype=int)
fX = f(X).ravel()
y_mc = np.empty(y.shape, dtype=int)  # multi-class
y_mc[fX < -0.35] = 0
y_mc[(fX >= -0.35) & (fX < 0.35)] = 1
y_mc[fX > 0.35] = 2


fixed_kernel = RBF(length_scale=1.0, length_scale_bounds="fixed")
kernels = [
    RBF(length_scale=0.1),
    fixed_kernel,
    RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
    C(1.0, (1e-2, 1e2)) * RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
]

Review comment (suggestion):
Instead, import `from sklearn.utils.fixes import sp_version`.

Code after:
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

import warnings

import numpy as np
import pytest
from scipy.optimize import approx_fprime

from sklearn.base import clone
from sklearn.exceptions import ConvergenceWarning
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import (
    RBF,
    CompoundKernel,
    WhiteKernel,
)
from sklearn.gaussian_process.kernels import (
    ConstantKernel as C,
)
from sklearn.gaussian_process.tests._mini_sequence_kernel import MiniSeqKernel
from sklearn.utils._testing import (
    assert_allclose,
    assert_almost_equal,
    assert_array_equal,
)


def f(x):
    return np.sin(x)


X = np.atleast_2d(np.linspace(0, 10, 30)).T
X2 = np.atleast_2d([2.0, 4.0, 5.5, 6.5, 7.5]).T
y = np.array(f(X).ravel() > 0, dtype=int)
fX = f(X).ravel()
y_mc = np.empty(y.shape, dtype=int)  # multi-class
y_mc[fX < -0.35] = 0
y_mc[(fX >= -0.35) & (fX < 0.35)] = 1
y_mc[fX > 0.35] = 2


fixed_kernel = RBF(length_scale=1.0, length_scale_bounds="fixed")
kernels = [
    RBF(length_scale=0.1),
    fixed_kernel,
    RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
    C(1.0, (1e-2, 1e2)) * RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
]
non_fixed_kernels = [kernel for kernel in kernels if kernel != fixed_kernel]
Repository: scikit-learn/scikit-learn
File: sklearn/gaussian_process/tests/test_gpc.py (Python)

Code before:
# SPDX-License-Identifier: BSD-3-Clause

import warnings

import numpy as np
import pytest
import scipy

from sklearn.base import clone
from sklearn.exceptions import ConvergenceWarning
from sklearn.externals._packaging.version import parse as parse_version
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import (
    RBF,
    CompoundKernel,
    Product,
    WhiteKernel,
)
from sklearn.gaussian_process.kernels import (
    ConstantKernel as C,
)
from sklearn.gaussian_process.tests._mini_sequence_kernel import MiniSeqKernel
from sklearn.utils._testing import assert_almost_equal, assert_array_equal

sp_version = parse_version(scipy.__version__)
if not sp_version < parse_version("1.15.0"):
    from scipy.differentiate import derivative


def f(x):
    return np.sin(x)


X = np.atleast_2d(np.linspace(0, 10, 30)).T
X2 = np.atleast_2d([2.0, 4.0, 5.5, 6.5, 7.5]).T
y = np.array(f(X).ravel() > 0, dtype=int)
fX = f(X).ravel()
y_mc = np.empty(y.shape, dtype=int)  # multi-class
y_mc[fX < -0.35] = 0
y_mc[(fX >= -0.35) & (fX < 0.35)] = 1
y_mc[fX > 0.35] = 2


fixed_kernel = RBF(length_scale=1.0, length_scale_bounds="fixed")
kernels = [
    RBF(length_scale=0.1),
    fixed_kernel,
    RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
    C(1.0, (1e-2, 1e2)) * RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
]
non_fixed_kernels = [kernel for kernel in kernels if kernel != fixed_kernel]

Review comment (suggestion):
```suggestion
if sp_version >= parse_version("1.15.0"):
```

Code after:
# SPDX-License-Identifier: BSD-3-Clause

import warnings

import numpy as np
import pytest
from scipy.optimize import approx_fprime

from sklearn.base import clone
from sklearn.exceptions import ConvergenceWarning
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import (
    RBF,
    CompoundKernel,
    WhiteKernel,
)
from sklearn.gaussian_process.kernels import (
    ConstantKernel as C,
)
from sklearn.gaussian_process.tests._mini_sequence_kernel import MiniSeqKernel
from sklearn.utils._testing import (
    assert_allclose,
    assert_almost_equal,
    assert_array_equal,
)


def f(x):
    return np.sin(x)


X = np.atleast_2d(np.linspace(0, 10, 30)).T
X2 = np.atleast_2d([2.0, 4.0, 5.5, 6.5, 7.5]).T
y = np.array(f(X).ravel() > 0, dtype=int)
fX = f(X).ravel()
y_mc = np.empty(y.shape, dtype=int)  # multi-class
y_mc[fX < -0.35] = 0
y_mc[(fX >= -0.35) & (fX < 0.35)] = 1
y_mc[fX > 0.35] = 2


fixed_kernel = RBF(length_scale=1.0, length_scale_bounds="fixed")
kernels = [
    RBF(length_scale=0.1),
    fixed_kernel,
    RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
    C(1.0, (1e-2, 1e2)) * RBF(length_scale=1.0, length_scale_bounds=(1e-3, 1e3)),
]
non_fixed_kernels = [kernel for kernel in kernels if kernel != fixed_kernel]
Repository: scikit-learn/scikit-learn
File: sklearn/metrics/_regression.py (Python)

Code before:
        y_true,
        y_pred,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    if sample_weight is None:
        sample_weight = xp.ones([y_true.shape[0]], dtype=y_pred.dtype, device=device_)

    y_quantile = xp.tile(
        _weighted_percentile(
            y_true, sample_weight=sample_weight, percentile_rank=alpha * 100, xp=xp
        ),
        (y_true.shape[0], 1),
    )

    denominator = mean_pinball_loss(
        y_true,
        y_quantile,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    return _assemble_r2_explained_variance(
        numerator=numerator,
        denominator=denominator,
        n_outputs=y_true.shape[1],
        multioutput=multioutput,
        force_finite=True,
        xp=xp,
        device=device_,
    )


@validate_params(
    {
        "y_true": ["array-like"],
        "y_pred": ["array-like"],
        "sample_weight": ["array-like", None],
        "multioutput": [
            StrOptions({"raw_values", "uniform_average"}),
            "array-like",
        ],
    },
    prefer_skip_nested_validation=True,
)
def d2_absolute_error_score(
    y_true, y_pred, *, sample_weight=None, multioutput="uniform_average"
):

Review comment (suggestion):
We should probably rename this to `_assemble_d2_score`, `_assemble_fraction_of_explained_deviance` or similar to avoid confusion.

Code after:
    >>> from sklearn.model_selection import GridSearchCV
    >>> from sklearn.linear_model import QuantileRegressor
    >>> X = np.array([[1], [2], [3], [4]])
    >>> y = np.array([2.5, 0.0, 2, 8])
    >>> pinball_95_scorer = make_scorer(d2_pinball_score, alpha=0.95)
    >>> grid = GridSearchCV(
    ...     QuantileRegressor(quantile=0.95),
    ...     param_grid={"fit_intercept": [True, False]},
    ...     scoring=pinball_95_scorer,
    ...     cv=2,
    ... ).fit(X, y)
    >>> grid.best_params_
    {'fit_intercept': True}
    """
    xp, _, device_ = get_namespace_and_device(
        y_true, y_pred, sample_weight, multioutput
    )
    _, y_true, y_pred, sample_weight, multioutput = (
        _check_reg_targets_with_floating_dtype(
            y_true, y_pred, sample_weight, multioutput, xp=xp
        )
    )

    if _num_samples(y_pred) < 2:
        msg = "D^2 score is not well-defined with less than two samples."
        warnings.warn(msg, UndefinedMetricWarning)
        return float("nan")

    numerator = mean_pinball_loss(
        y_true,
        y_pred,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    if sample_weight is None:
        sample_weight = xp.ones([y_true.shape[0]], dtype=y_true.dtype, device=device_)

    y_quantile = xp.tile(
        _weighted_percentile(
            y_true,
            sample_weight=sample_weight,
            percentile_rank=alpha * 100,
            average=True,
            xp=xp,
        ),
        (y_true.shape[0], 1),
    )

    denominator = mean_pinball_loss(
Repository: scikit-learn/scikit-learn
File: sklearn/metrics/_regression.py (Python)

Code before:
    {'fit_intercept': True}
    """
    xp, _, device_ = get_namespace_and_device(
        y_true, y_pred, sample_weight, multioutput
    )
    _, y_true, y_pred, sample_weight, multioutput = (
        _check_reg_targets_with_floating_dtype(
            y_true, y_pred, sample_weight, multioutput, xp=xp
        )
    )

    if _num_samples(y_pred) < 2:
        msg = "D^2 score is not well-defined with less than two samples."
        warnings.warn(msg, UndefinedMetricWarning)
        return float("nan")

    numerator = mean_pinball_loss(
        y_true,
        y_pred,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    if sample_weight is None:
        sample_weight = xp.ones([y_true.shape[0]], dtype=y_pred.dtype, device=device_)

    y_quantile = xp.tile(
        _weighted_percentile(
            y_true,
            sample_weight=sample_weight,
            percentile_rank=alpha * 100,
            average=True,
            xp=xp,
        ),
        (y_true.shape[0], 1),
    )

    denominator = mean_pinball_loss(
        y_true,
        y_quantile,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    return _assemble_fraction_of_explained_deviance(
        numerator=numerator,
        denominator=denominator,
        n_outputs=y_true.shape[1],
        multioutput=multioutput,

Review comment (suggestion):
Just a question, at this point `y_pred`, `y_true` will have the same dtype right? So `y_pred.dtype` and `y_true.dtype` would be the same

Code after:
    {'fit_intercept': True}
    """
    xp, _, device_ = get_namespace_and_device(
        y_true, y_pred, sample_weight, multioutput
    )
    _, y_true, y_pred, sample_weight, multioutput = (
        _check_reg_targets_with_floating_dtype(
            y_true, y_pred, sample_weight, multioutput, xp=xp
        )
    )

    if _num_samples(y_pred) < 2:
        msg = "D^2 score is not well-defined with less than two samples."
        warnings.warn(msg, UndefinedMetricWarning)
        return float("nan")

    numerator = mean_pinball_loss(
        y_true,
        y_pred,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    if sample_weight is None:
        sample_weight = xp.ones([y_true.shape[0]], dtype=y_true.dtype, device=device_)

    y_quantile = xp.tile(
        _weighted_percentile(
            y_true,
            sample_weight=sample_weight,
            percentile_rank=alpha * 100,
            average=True,
            xp=xp,
        ),
        (y_true.shape[0], 1),
    )

    denominator = mean_pinball_loss(
        y_true,
        y_quantile,
        sample_weight=sample_weight,
        alpha=alpha,
        multioutput="raw_values",
    )

    return _assemble_fraction_of_explained_deviance(
        numerator=numerator,
        denominator=denominator,
        n_outputs=y_true.shape[1],
        multioutput=multioutput,
Repository: scikit-learn/scikit-learn
File: sklearn/linear_model/tests/test_coordinate_descent.py (Python)

Code before:
            w=coef_1,
            alpha=alpha_max,
            X=X_centered,
            y=y,
            **params,
            do_screening=do_screening,
        )
        assert_allclose(coef_1, 0)

    # Without gap safe screening rules
    coef_1 = zc()
    cd_fast.enet_coordinate_descent(
        w=coef_1, alpha=alpha, X=X_centered, y=y, **params, do_screening=False
    )
    # At least 2 coefficients are non-zero
    assert 2 <= np.sum(np.abs(coef_1) > 1e-8) < X.shape[1]

    # With gap safe screening rules
    coef_2 = zc()
    cd_fast.enet_coordinate_descent(
        w=coef_2, alpha=alpha, X=X_centered, y=y, **params, do_screening=True
    )
    assert_allclose(coef_2, coef_1)

    # Sparse
    coef_3 = zc()
    Xs = sparse.csc_matrix(X)
    for do_screening in [True, False]:
        coef_3 = zc()
        cd_fast.sparse_enet_coordinate_descent(
            w=coef_3,
            alpha=alpha,
            X_data=Xs.data,
            X_indices=Xs.indices,
            X_indptr=Xs.indptr,
            y=y,
            sample_weight=None,
            X_mean=X_mean,
            **params,
            do_screening=do_screening,
        )
        assert_allclose(coef_3, coef_1)

    # Gram
    for do_screening in [True, False]:
        coef_4 = zc()
        cd_fast.enet_coordinate_descent_gram(
            w=coef_4,
            alpha=alpha,
            Q=X_centered.T @ X_centered,
            q=X_centered.T @ y,

Review comment (suggestion):
This line does not seem needed.

```suggestion
```

Code after:
            w=coef_1,
            alpha=alpha_max,
            X=X_centered,
            y=y,
            **params,
            do_screening=do_screening,
        )
        assert_allclose(coef_1, 0)

    # Without gap safe screening rules
    coef_1 = zc()
    cd_fast.enet_coordinate_descent(
        w=coef_1, alpha=alpha, X=X_centered, y=y, **params, do_screening=False
    )
    # At least 2 coefficients are non-zero
    assert 2 <= np.sum(np.abs(coef_1) > 1e-8) < X.shape[1]

    # With gap safe screening rules
    coef_2 = zc()
    cd_fast.enet_coordinate_descent(
        w=coef_2, alpha=alpha, X=X_centered, y=y, **params, do_screening=True
    )
    assert_allclose(coef_2, coef_1)

    # Sparse
    Xs = sparse.csc_matrix(X)
    for do_screening in [True, False]:
        coef_3 = zc()
        cd_fast.sparse_enet_coordinate_descent(
            w=coef_3,
            alpha=alpha,
            X_data=Xs.data,
            X_indices=Xs.indices,
            X_indptr=Xs.indptr,
            y=y,
            sample_weight=None,
            X_mean=X_mean,
            **params,
            do_screening=do_screening,
        )
        assert_allclose(coef_3, coef_1)

    # Gram
    for do_screening in [True, False]:
        coef_4 = zc()
        cd_fast.enet_coordinate_descent_gram(
            w=coef_4,
            alpha=alpha,
            Q=X_centered.T @ X_centered,
            q=X_centered.T @ y,
            y=y,
Repository: scikit-learn/scikit-learn
File: examples/semi_supervised/plot_semi_supervised_versus_svm_iris.py (Python)

Code before:
"""
===============================================================================
Decision boundary of semi-supervised classifiers versus SVM on the Iris dataset
===============================================================================

This example compares decision boundaries learned by two semi-supervised
methods, namely :class:`~sklearn.semi_supervised.LabelSpreading` and
:class:`~sklearn.semi_supervised.SelfTrainingClassifier`, when varying the
proportion of labeled training data from small fractions up to the full dataset.

Both methods rely on RBF kernels: Label Spreading uses it by default, and
Self-training is paired here with :class:`~sklearn.svm.SVC` as base estimator
(also RBF-based by default) to allow a fair comparison. Self-training with 100%
labeled data is omitted since it is identical to training a fully supervised SVC
directly.

In a second section, we explain how `predict_proba` is computed in Label
Spreading and Self-training.

See
:ref:`sphx_glr_auto_examples_semi_supervised_plot_semi_supervised_newsgroups.py`
for a comparison of `LabelSpreading` and `SelfTrainingClassifier` in terms of
performance.
"""

# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

# %%
import matplotlib.pyplot as plt
import numpy as np

from sklearn.datasets import load_iris

Review comment (suggestion):
```suggestion
:class:`~sklearn.semi_supervised.SelfTrainingClassifier`, while varying the
```

I think that's more common.

Code after:
"""
===============================================================================
Decision boundary of semi-supervised classifiers versus SVM on the Iris dataset
===============================================================================

This example compares decision boundaries learned by two semi-supervised
methods, namely :class:`~sklearn.semi_supervised.LabelSpreading` and
:class:`~sklearn.semi_supervised.SelfTrainingClassifier`, while varying the
proportion of labeled training data from small fractions up to the full dataset.

Both methods rely on RBF kernels: :class:`~sklearn.semi_supervised.LabelSpreading` uses
it by default, and :class:`~sklearn.semi_supervised.SelfTrainingClassifier` is paired
here with :class:`~sklearn.svm.SVC` as base estimator (also RBF-based by default) to
allow a fair comparison. With 100% labeled data,
:class:`~sklearn.semi_supervised.SelfTrainingClassifier` reduces to a fully supervised
:class:`~sklearn.svm.SVC`, since there are no unlabeled points left to pseudo-label.

In a second section, we explain how `predict_proba` is computed in
:class:`~sklearn.semi_supervised.LabelSpreading` and
:class:`~sklearn.semi_supervised.SelfTrainingClassifier`.

See
:ref:`sphx_glr_auto_examples_semi_supervised_plot_semi_supervised_newsgroups.py`
for a comparison of `LabelSpreading` and `SelfTrainingClassifier` in terms of
performance.
"""

# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

# %%
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
Repository: scikit-learn/scikit-learn
File: sklearn/svm/_classes.py (Python)

Code before:
    _impl = "c_svc"

    def __init__(
        self,
        *,
        C=1.0,
        kernel="rbf",
        degree=3,
        gamma="scale",
        coef0=0.0,
        shrinking=True,
        probability="deprecated",
        tol=1e-3,
        cache_size=200,
        class_weight=None,
        verbose=False,
        max_iter=-1,
        decision_function_shape="ovr",
        break_ties=False,
        random_state=None,
    ):
        if probability != "deprecated":
            warnings.warn(
                "parameter `probability` will be deprecated in version 1.8, "
                "use `CalibratedClassifierCV(SVC(), ensemble=False)` instead "
                "of `SVC(probability=True)`",
                FutureWarning,
            )
        else:
            probability = False

        super().__init__(
            kernel=kernel,
            degree=degree,
            gamma=gamma,
            coef0=coef0,
            tol=tol,
            C=C,
            nu=0.0,
            shrinking=shrinking,
            probability=probability,
            cache_size=cache_size,
            class_weight=class_weight,
            verbose=verbose,
            max_iter=max_iter,
            decision_function_shape=decision_function_shape,
            break_ties=break_ties,
            random_state=random_state,
        )



Review comment (suggestion):
```suggestion
                "Parameter `probability` is deprecated in version 1.8, and will"
                "be removed in 1.10. Use "
                "`CalibratedClassifierCV(SVC(), ensemble=False)` instead of "
                "`SVC(probability=True)`",
```

Code after:
    _impl = "c_svc"

    def __init__(
        self,
        *,
        C=1.0,
        kernel="rbf",
        degree=3,
        gamma="scale",
        coef0=0.0,
        shrinking=True,
        probability="deprecated",
        tol=1e-3,
        cache_size=200,
        class_weight=None,
        verbose=False,
        max_iter=-1,
        decision_function_shape="ovr",
        break_ties=False,
        random_state=None,
    ):
        super().__init__(
            kernel=kernel,
            degree=degree,
            gamma=gamma,
            coef0=coef0,
            tol=tol,
            C=C,
            nu=0.0,
            shrinking=shrinking,
            probability=probability,
            cache_size=cache_size,
            class_weight=class_weight,
            verbose=verbose,
            max_iter=max_iter,
            decision_function_shape=decision_function_shape,
            break_ties=break_ties,
            random_state=random_state,
        )


class NuSVC(BaseSVC):
    """Nu-Support Vector Classification.

    Similar to SVC but uses a parameter to control the number of support
    vectors.

    The implementation is based on libsvm.

    Read more in the :ref:`User Guide <svm_classification>`.