Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nns/multivariate_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _resolve_n_best(
if n_best is not None:
return max(1, int(n_best))
dependence = _copula_matrix(np.column_stack((x, y)))
return max(1, math.floor((1.0 - dependence) * math.sqrt(x.shape[1])))
return max(1, math.floor((1.0 - dependence) * math.sqrt(x.shape[0])))


def _k_as_count(k: KValue, row_count: int) -> int:
Expand Down
7 changes: 6 additions & 1 deletion src/nns/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,12 @@ def _as_point_est(point_est: NDArray[np.float64] | float | None) -> NDArray[np.f


def _regression_dependence(x: NDArray[np.float64], y: NDArray[np.float64]) -> float:
dep = nns_dep(x, y, asym=True)["Dependence"]
# Mirrors R Regression.R's tryCatch chain: NNS.dep error -> 0.1, copula
# error -> keep the NNS.dep component, NA -> 0.1.
try:
dep = nns_dep(x, y, asym=True)["Dependence"]
except (ValueError, FloatingPointError, ZeroDivisionError):
dep = 0.1
try:
scaled = np.column_stack(
(
Expand Down
Loading