You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromsklearn.datasetsimportfetch_mldatafromsklearn.semi_supervisedimportlabel_propagationimportnumpynumpy.seterr(all='raise')
mnist=fetch_mldata('MNIST original', data_home="./tmp")
X=mnist.data[1:10000]
y=mnist.target[1:10000]
# Use only 300 labeled examplesy[300:] =-1lp_model=label_propagation.LabelSpreading(kernel='rbf', n_neighbors=7, n_jobs=-1)
lp_model.fit(X,y)
Expected Results
No error should be thrown.
Actual Results
Traceback (most recent call last):
File "reproduce.py", line 21, in <module>
lp_model.fit(X,y)
File "/share/mug/gentoo/anaconda3/envs/ssl-py3/lib/python3.6/site-packages/sklearn/semi_supervised/label_propagation.py", line 234, in fit
graph_matrix = self._build_graph()
File "/share/mug/gentoo/anaconda3/envs/ssl-py3/lib/python3.6/site-packages/sklearn/semi_supervised/label_propagation.py", line 511, in _build_graph
affinity_matrix = self._get_kernel(self.X_)
File "/share/mug/gentoo/anaconda3/envs/ssl-py3/lib/python3.6/site-packages/sklearn/semi_supervised/label_propagation.py", line 131, in _get_kernel
return rbf_kernel(X, X, gamma=self.gamma)
File "/share/mug/gentoo/anaconda3/envs/ssl-py3/lib/python3.6/site-packages/sklearn/metrics/pairwise.py", line 837, in rbf_kernel
np.exp(K, K) # exponentiate K in-place
FloatingPointError: underflow encountered in exp
The text was updated successfully, but these errors were encountered:
Description
LabelPropagation
with therbf
kernel should ignore underflow errors.Steps/Code to Reproduce
Example taken from #9292.
Expected Results
No error should be thrown.
Actual Results
The text was updated successfully, but these errors were encountered: