Skip to content
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

Get docs to build #51

Merged
merged 1 commit into from
Sep 4, 2023
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
176 changes: 112 additions & 64 deletions docs/notebooks/Basic_usage.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dev = [
"pytest-cov",
"sphinx",
"sphinxcontrib-apidoc",
"sphinx_copybutton",
"furo",
"myst_nb",
"jupyter",
Expand Down
18 changes: 12 additions & 6 deletions src/redflag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
from .importance import *
from .outliers import *

# From https://github.com/pypa/setuptools_scm
from importlib.metadata import version, PackageNotFoundError

from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = version("package-name")
except PackageNotFoundError:
# package is not installed
pass
VERSION = get_distribution(__name__).version
except DistributionNotFound:
try:
from ._version import version as VERSION
except ImportError:
raise ImportError(
"Failed to find (autogenerated) _version.py. "
"This might be because you are installing from GitHub's tarballs, "
"use the PyPI ones."
)
__version__ = VERSION
7 changes: 4 additions & 3 deletions src/redflag/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,13 @@ def wasserstein(X: ArrayLike,
pass

if stacked:
if not is_standard_normal(first.flat):
warnings.warn('First group does not appear to be standardized.', stacklevel=2)
# Not sure this test makes sense any more.
# if not is_standard_normal(first.flat):
# warnings.warn('First group does not appear to be standardized.', stacklevel=2)
groups = np.hstack([len(dataset)*[i] for i, dataset in enumerate(X)])
X = np.vstack(X)

# Now we can certainly treat X as a 2D array.
# Now we can treat X as a 2D array.
X = np.asarray(X)
if X.ndim != 2:
raise ValueError("X must be a 2D array-like.")
Expand Down