scikit-learn-contrib / metric-learn

Metric learning algorithms in Python
http://contrib.scikit-learn.org/metric-learn/
MIT License
1.4k stars 234 forks source link

Does somebody meet this Error ? I need some help . #306

Open yuanborong opened 3 years ago

yuanborong commented 3 years ago

Description

It's a great code about the famous metric learning algorithm.

But when I want to use algorithm 'MMC' to fit my own data , I found that there is an Error like:

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  far_source_sample['far_close'] = np.ones((far_source_sample.shape[0] , 1))
Traceback (most recent call last):
  File "MMC_before_clustering.py", line 87, in <module>
    mmc.fit(sample_pairs , y_pairs_list)
  File "/home/huxinhou/.local/lib/python3.6/site-packages/metric_learn/mmc.py", line 452, in fit
    self._fit(pairs, y)
  File "/home/huxinhou/.local/lib/python3.6/site-packages/metric_learn/mmc.py", line 40, in _fit
    return self._fit_full(pairs, y)
  File "/home/huxinhou/.local/lib/python3.6/site-packages/metric_learn/mmc.py", line 111, in _fit_full
    l, V = np.linalg.eigh((A + A.T) / 2)
  File "<__array_function__ internals>", line 6, in eigh
  File "/home/huxinhou/.local/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 1471, in eigh
    w, vt = gufunc(a, signature=signature, extobj=extobj)
  File "/home/huxinhou/.local/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 94, in _raise_linalgerror_eigenvalues_nonconvergence
    raise LinAlgError("Eigenvalues did not converge")
numpy.linalg.LinAlgError: Eigenvalues did not converge

I am confused how this Error occurs . Does somebody know how to fix it ?? Thank you .

Expected Results

Actual Results

Versions

wdevazelhes commented 3 years ago

Hi @yuanborong, thanks for raising this issue, could you provide a minimal reproducible example so we can reproduce the error, including what are your sample_pairs and y_pairs_list ? Thanks!