PerformanceEstimation / PEPit

PEPit is a package enabling computer-assisted worst-case analyses of first-order optimization methods.
https://pepit.readthedocs.io/en/latest/
MIT License
76 stars 10 forks source link

Postprocessing issue #64

Closed AdrienTaylor closed 2 years ago

AdrienTaylor commented 2 years ago

For the record: postprocessing issue when no eigenvalue is set to zero. Error below: problem in "pep.py" in "get_nb_eigenvalues_and_corrected_matrix(M)"

This is particularly problematic when trying to find low dimensional instances.


ValueError Traceback (most recent call last) /tmp/ipykernel_635912/2564841825.py in 41 42 # Solve the PEP ---> 43 pepit_tau = problem.solve(verbose=1, dimension_reduction_heuristic="logdet2")

~/anaconda3/lib/python3.9/site-packages/PEPit/pep.py in solve(self, verbose, return_full_cvxpy_problem, dimension_reduction_heuristic, eig_regularization, tol_dimension_reduction, **kwargs) 369 370 # Print the estimated dimension before dimension reduction --> 371 nb_eigenvalues, eig_threshold, corrected_G_value = self.get_nb_eigenvalues_and_corrected_matrix(G.value) 372 if verbose: 373 print('(PEPit) Postprocessing: {} eigenvalue(s) > {} before dimension reduction'.format(nb_eigenvalues,

~/anaconda3/lib/python3.9/site-packages/PEPit/pep.py in get_nb_eigenvalues_and_corrected_matrix(M) 466 467 # Get the highest eigenvalue that have been set to 0. --> 468 eig_threshold = max(np.max(eig_val[non_zero_eig_vals == 0]), 0) 469 470 return nb_eigenvalues, eig_threshold, corrected_S

<__array_function__ internals> in amax(*args, **kwargs) ~/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py in amax(a, axis, out, keepdims, initial, where) 2731 5 2732 """ -> 2733 return _wrapreduction(a, np.maximum, 'max', axis, None, out, 2734 keepdims=keepdims, initial=initial, where=where) 2735 ~/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs) 85 return reduction(axis=axis, out=out, **passkwargs) 86 ---> 87 return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 88 89 ValueError: zero-size array to reduction operation maximum which has no identity
AdrienTaylor commented 2 years ago

Solved in PR #61