Skip to content

SVC(probability=True) is not thread-safe #31885

@ogrisel

Description

@ogrisel

This was discovered while running:

pytest -v --parallel-threads=4 --iterations=2 sklearn/svm/tests/test_sparse.py

before including the fix pushed to #30041 under bce2b4e.

I suspect the problem is that the built-in Platt scaling implementation of the vendored C++ code base of libsvm that uses a singleton pseudo random generator. Therefore, seeding the shared RNG state from competing threads prevents getting reproducible results and hence the test failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions