Closed bwpriest closed 1 year ago
The particular error is:
Notebook error:
CellExecutionError in examples/fast_regression_tutorial.ipynb:
------------------
from MuyGPyS.gp.distance import make_fast_regress_tensors, fast_nn_update
nn_indices,_ = nbrs_lookup.get_nns(train_features)
nn_indices = nn_indices.astype(int)
precomputed_coefficients_matrix = muygps.build_fast_regress_coeffs(
train_features,
nn_indices,
train_responses)
------------------
---------------------------------------------------------------------------
LinAlgError Traceback (most recent call last)
/var/folders/n4/673tyjz54_15v7qjdh4slnqr000v_5/T/ipykernel_99597/1960471781.py in <module>
3 nn_indices = nn_indices.astype(int)
4
----> 5 precomputed_coefficients_matrix = muygps.build_fast_regress_coeffs(
6 train_features,
7 nn_indices,
~/workspace/muygps/repos/MuyGPyS/MuyGPyS/gp/muygps.py in build_fast_regress_coeffs(self, train, nn_indices, targets, indices_by_rank)
276 K = self.kernel(pairwise_dists_fast)
277
--> 278 return self._build_fast_regress_coeffs(
279 K, self.eps(), train_nn_targets_fast
280 )
~/workspace/muygps/repos/MuyGPyS/MuyGPyS/gp/muygps.py in _build_fast_regress_coeffs(K, eps, train_nn_targets_fast)
287 ) -> mm.ndarray:
288
--> 289 return _muygps_fast_regress_precompute(
290 _homoscedastic_perturb(K, eps), train_nn_targets_fast
291 )
~/workspace/muygps/repos/MuyGPyS/MuyGPyS/_src/gp/muygps/numpy.py in _muygps_fast_regress_precompute(K, train_nn_targets_fast)
51 train_nn_targets_fast: np.ndarray,
52 ) -> np.ndarray:
---> 53 return np.linalg.solve(K, train_nn_targets_fast)
~/.venvs/MuyGPyS/lib/python3.10/site-packages/numpy/core/overrides.py in solve(*args, **kwargs)
~/.venvs/MuyGPyS/lib/python3.10/site-packages/numpy/linalg/linalg.py in solve(a, b)
391 signature = 'DD->D' if isComplexType(t) else 'dd->d'
392 extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
--> 393 r = gufunc(a, b, signature=signature, extobj=extobj)
394
395 return wrap(r.astype(result_t, copy=False))
~/.venvs/MuyGPyS/lib/python3.10/site-packages/numpy/linalg/linalg.py in _raise_linalgerror_singular(err, flag)
86
87 def _raise_linalgerror_singular(err, flag):
---> 88 raise LinAlgError("Singular matrix")
89
90 def _raise_linalgerror_nonposdef(err, flag):
LinAlgError: Singular matrix
LinAlgError: Singular matrix
I broke this even more now that I've removed MuyGPS.fast_regress_from_indices
, but that should be an easy fix (just need to build the tensors explicitly)
This was addressed in PR #109
This probably was caused by something that I did. However, I looked at the notebook more closely and I think that it needs a facelift anyway. It is mean to be read and understood, which I do not think a non-expert can do in its current state. We need to clean it up, fix the problem, and add a lot more markdown.