-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH, WIP] Adding CMI test #12
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Adam Li <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #12 +/- ##
=======================================
Coverage ? 22.08%
=======================================
Files ? 6
Lines ? 240
Branches ? 31
=======================================
Hits ? 53
Misses ? 186
Partials ? 1 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
n_shuffle: int = 100, | ||
random_seed: Optional[int] = None | ||
) -> PValueResult: | ||
rng = np.random.default_rng(random_seed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning this?
n_shuffle: int = 100, | ||
random_seed: Optional[int] = None | ||
) -> PValueResult: | ||
rng = np.random.default_rng(random_seed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returning?
val = hxyz - (hxz + hyz - hz).mean() | ||
return val | ||
|
||
def _preprocess_data(self, data: pd.DataFrame) -> pd.DataFrame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, indices = nbrs.kneighbors(z_arr) | ||
elif method == "kdtree": | ||
tree_xyz = scipy.spatial.cKDTree(z_arr) | ||
indices = tree_xyz.query(z_arr, k=k, p=np.inf, eps=0.0, workers=n_jobs)[1].astype(np.int32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else: return ValueError
rng = np.random.default_rng(seed=random_seed) | ||
|
||
# initialize the final permutation order | ||
restricted_perm = np.zeros((n_samples,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restricted_perm = np.zeros((n_samples,)) | |
restricted_perm = np.zeros((n_samples,), dtype=np.int32) |
if it has not been used to permute another sample. If it has been, then the | ||
algorithm looks at the next nearest-neighbor and so on. If all k-nearest | ||
neighbors of a sample has been checked, then a random neighbor is chosen. In this | ||
manner, the algorithm tries to perform permutation without replacement, but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
citation?
Towards: #5
Changes proposed in this pull request:
This is still a draft.
Before submitting
section of the
CONTRIBUTING
docs.Writing docstrings section of the
CONTRIBUTING
docs.After submitting