Skip to content

Label Spreading clumping factor must be strictly positive #12753

@giasemidis

Description

@giasemidis

Description

The clumping factor, alpha, of Label Spreading semi-supervised algorithm must be in the open interval (0,1), otherwise an error is thrown, see lines 244-247 in the label_propagation.py file (version of sklearn 0.20.1). According to documentation the clumping factor takes values in the closed interval [0, 1].

Steps/Code to Reproduce

Example:

import numpy as np
import sklearn
from sklearn.semi_supervised import LabelSpreading

print(sklearn.__version__)

X = np.random.rand(100, 5)
y = - np.ones(100)
y[0] = 0
y[1] = 1

model = LabelSpreading(kernel='rbf', gamma=1, alpha=0)
model.fit(X, y)

Actual Results

ValueError: alpha=0 is invalid: it must be inside the open interval (0, 1)

Versions

For scikit-learn >= 0.20:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions