-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename "irrelevants" to "off-topic" for Clarity (#8)
* started with renaming * version bump * added missing target * installation problem fixes * optimized req * fixed package building * fixed last bit of issues and ran examples * added test for backwards compability check
- Loading branch information
Showing
50 changed files
with
353 additions
and
350 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "ssl_library"] | ||
path = src/ssl_library | ||
path = selfclean/ssl_library | ||
url = https://github.com/mse-thesis-dermatology/ssl_library |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,22 +1,48 @@ | ||
[build-system] | ||
requires = [ "setuptools>=42", "wheel",] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "SelfClean" | ||
description = "A holistic self-supervised data cleaning strategy to detect irrelevant samples, near duplicates and label errors." | ||
authors = [ | ||
{ name = "Fabian Gröger", email = "[email protected]" }, | ||
] | ||
version = "0.0.35" | ||
name = "selfclean" | ||
description = "A holistic self-supervised data cleaning strategy to detect off-topic samples, near duplicates and label errors." | ||
readme = "README.md" | ||
keywords = [ "machine_learning", "data_cleaning", "datacentric_ai", "datacentric", "self-supervised learning",] | ||
requires-python = ">=3.6" | ||
classifiers = [ "Programming Language :: Python :: 3", "Operating System :: OS Independent",] | ||
dependencies = [ "SciencePlots", "black>=22.6", "codecov", "coverage>=6", "darglint>=1.8", "einops", "isort>=5.10", "jupyter", "loguru", "matplotlib", "memory-profiler", "numpy", "pandas", "pre-commit>=2.20", "pytest", "pytest-cov>=3", "scikit-image", "scikit_learn", "seaborn", "torchinfo", "torchmetrics", "torchvision", "tqdm", "transformers[torch]==4.27.4",] | ||
[[project.authors]] | ||
name = "Fabian Gröger" | ||
email = "[email protected]" | ||
|
||
[project.license] | ||
text = "Attribution-NonCommercial 4.0 International" | ||
|
||
[project.optional-dependencies] | ||
approximate_nn = [ "annoy",] | ||
|
||
[project.urls] | ||
Homepage = "https://selfclean.github.io/" | ||
"Source Code" = "https://github.com/Digital-Dermatology/SelfClean" | ||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
|
||
[tool.black] | ||
include = '\.pyi?$' | ||
include = "\\.pyi?$" | ||
|
||
[tool.isort] | ||
profile = "black" | ||
skip_gitignore=true | ||
py_version=39 | ||
skip_gitignore = true | ||
py_version = 39 | ||
default_section = "THIRDPARTY" | ||
known_thirdparty=["wandb"] | ||
known_thirdparty = [ "wandb",] | ||
|
||
[tool.pytest.ini_options] | ||
# Set true to see logger ouput in test command line window | ||
log_cli = false | ||
log_cli_level = "INFO" | ||
log_cli_format = "%(time)s :: %(name)s :: %(message)s" | ||
|
||
[tool.setuptools.packages.find] | ||
include = [ "selfclean*", "selfclean.*",] | ||
exclude = [ "tests*", "tests.*", "*.tests", "*.tests.*", "*.tests*",] |
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,9 @@ | ||
""" | ||
SelfClean. | ||
A holistic self-supervised data cleaning strategy to detect off-topic samples, near duplicates and label errors. | ||
""" | ||
|
||
__author__ = "Fabian Groeger" | ||
|
||
from .cleaner.selfclean import SelfClean # noqa: F401 |
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
30 changes: 30 additions & 0 deletions
30
selfclean/cleaner/off_topic_samples/quantile_off_topic_mixin.py
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,30 @@ | ||
from typing import Tuple | ||
|
||
import numpy as np | ||
|
||
from ...cleaner.off_topic_samples.base_off_topic_mixin import BaseOffTopicMixin | ||
from ...ssl_library.src.utils.logging import plot_dist | ||
|
||
|
||
class QuantileOffTopicMixin(BaseOffTopicMixin): | ||
def __init__(self, quantile: float = 0.01, **kwargs): | ||
super().__init__(**kwargs) | ||
self.quantile = quantile | ||
|
||
def get_off_topic_ranking(self) -> Tuple[np.ndarray, np.ndarray]: | ||
off_topic_samples = np.quantile(self.distance_matrix, self.quantile, axis=0) | ||
off_topic_samples = [(off_topic_samples[i], i) for i in list(range(self.N))] | ||
off_topic_samples = sorted( | ||
off_topic_samples, | ||
key=lambda tup: tup[0], | ||
reverse=True, | ||
) | ||
|
||
if self.plot_distribution and off_topic_samples is not None: | ||
plot_dist( | ||
scores=np.asarray([x[0] for x in off_topic_samples]), | ||
title="Distribution of off-topic samples", | ||
) | ||
off_topic_scores = np.asarray([x[0] for x in off_topic_samples]) | ||
off_topic_indices = np.asarray([x[1] for x in off_topic_samples]) | ||
return off_topic_scores, off_topic_indices |
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
Oops, something went wrong.