-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement algorithm from paper `CS-Shapley: Class-wise Shapley Values…
… for Data Valuation in Classification` (https://arxiv.org/abs/2211.06800)
- Loading branch information
Markus Semmler
committed
Aug 12, 2023
1 parent
e42c304
commit 4bd92ec
Showing
19 changed files
with
1,780 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import numpy as np | ||
from numpy.typing import NDArray | ||
|
||
|
||
def arr_or_writeable_copy(arr: NDArray) -> NDArray: | ||
"""Return a copy of ``arr`` if it's not writeable, otherwise return ``arr``. | ||
:param arr: Array to copy if it's not writeable. | ||
:return: Copy of ``arr`` if it's not writeable, otherwise ``arr``. | ||
""" | ||
if not arr.flags.writeable: | ||
return np.copy(arr) | ||
|
||
return arr |
Oops, something went wrong.