Skip to content

Commit

Permalink
rename debug to return_indices
Browse files Browse the repository at this point in the history
  • Loading branch information
rchan26 committed Nov 24, 2023
1 parent c944883 commit 56fff8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions paper-examples/example2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
"print(f\"fit_time: {fit_time}\")\n",
"\n",
"inlier_dists, inlier_ix = signature_maha_knn.conformance(\n",
" data.test_inlier, n_neighbors=n_neighbours, debug=True\n",
" data.test_inlier, n_neighbors=n_neighbours, return_indices=True\n",
")\n",
"outlier_dists, outlier_ix = signature_maha_knn.conformance(\n",
" data.test_outlier, n_neighbors=n_neighbours, debug=True\n",
" data.test_outlier, n_neighbors=n_neighbours, return_indices=True\n",
")"
]
},
Expand Down
7 changes: 5 additions & 2 deletions src/signature_mahalanobis_knn/sig_mahal_knn.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def conformance(
X_test: np.ndarray | None = None,
signatures_test: np.ndarray | None = None,
n_neighbors: int = 20,
debug=False,
return_indices: bool = False,
) -> np.ndarray:
"""
Compute the conformance scores for the data points either passed in
Expand All @@ -199,6 +199,9 @@ def conformance(
signatures_test : np.ndarray | None, optional
Signatures of the data points, by default None.
Two dimensional array of shape (n_samples, sig_dim).
return_indices : bool, optional
Whether to return the indices of the nearest neighbors,
by default False.
Returns
-------
Expand Down Expand Up @@ -269,7 +272,7 @@ def conformance(
candidate_distances[rho > self.mahal_distance.subspace_thres] = np.inf

# compute the minimum of the candidate distances for each data point
if debug:
if return_indices:
return np.min(candidate_distances, axis=-1), train_indices

return np.min(candidate_distances, axis=-1)

0 comments on commit 56fff8f

Please sign in to comment.