rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.18k stars 527 forks source link

[BUG] A warning (Warning: could not fill working set) poped up when fitting svm.SVC #5721

Open OpsTreadstone opened 8 months ago

OpsTreadstone commented 8 months ago

Describe the bug When fitting Pipeline([('scaler', StandardScaler()), ('svc', SVC(kernel="rbf", gamma="scale"))]), I got the following warning:

[W] [15:01:53.908026] Warning: could not fill working set, found only 835 elements [W] [15:01:53.910185] Warning: could not fill working set, found only 869 elements

I was unable to find out what led to the warning above. Does this behavior have a negative influence on the training of SVC?

Steps/Code to reproduce bug

from cuml.pipeline import Pipeline
from cuml.preprocessing import StandardScaler
from cuml.svm import SVC
import numpy as np
import torch

def sample_uniformly_quasi(num, lb, ub, dtype=torch.float64):
    assert num > 0
    assert lb.ndim == 1
    assert ub.ndim == 1
    assert lb.shape[0] == ub.shape[0]
    assert np.all(lb <= ub)

    seed = np.random.randint(int(1e6))
    sobol = torch.quasirandom.SobolEngine(dimension=ub.shape[0], scramble=True, seed=seed)
    xs = sobol.draw(num, dtype=dtype).cpu().detach().numpy()
    xs = lb + (ub - lb) * xs

    return xs

dims = 2
lb = np.zeros((dims,))
ub = np.ones((dims,)) * 5.0

num = 1050
# generate random points using torch.quasirandom.SobolEngine,
# and project to the hypercube with bounds lb and ub
train_x = sample_uniformly_quasi(num=num, lb=lb, ub=ub)
train_y = np.zeros(shape=(num,), dtype=np.int64)
indices = np.random.choice(num, size=500, replace=False)
train_y[indices] = 1
train_weight = np.random.rand(train_x.shape[0])

svm_pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('svc', SVC(kernel="rbf", gamma="scale"))
])
svm_pipeline.fit(X=train_x, y=train_y, svc__sample_weight=train_weight)

Expected behavior I expected that no warnings or errors would be raised.

Environment details (please complete the following information):

dantegd commented 6 months ago

Thanks for the issue @OpsTreadstone, if I'm not mistaken this shouldn't affect things as long as the results you're seeing are within expectations, but @tfeher or @achirkin would be able to respond this better than myself.