From 70c5aebb560cafff9db7a3a62fe275510d3abd6c Mon Sep 17 00:00:00 2001 From: Christiaan Meijer Date: Tue, 6 Jun 2023 15:08:56 +0200 Subject: [PATCH] bump version to 1.0.0 --- .bumpversion.cfg | 2 +- CITATION.cff | 2 +- dianna/__init__.py | 61 ++++++++++++++++++++++++++-------------------- docs/conf.py | 47 +++++++++++++++-------------------- setup.cfg | 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 33354833..1faa3865 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.9.0 +current_version = 1.0.0 [comment] comment = The contents of this file cannot be merged with that of setup.cfg until https://github.com/c4urself/bump2version/issues/185 is resolved diff --git a/CITATION.cff b/CITATION.cff index 3a8e1c9a..dbfc6cc1 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -45,7 +45,7 @@ authors: orcid: "https://orcid.org/0000-0002-5413-9038" doi: 10.5281/zenodo.5801485 -version: "0.9.0" +version: "1.0.0" repository-code: "https://github.com/dianna-ai/dianna" keywords: - XAI diff --git a/dianna/__init__.py b/dianna/__init__.py index 70f0cdf3..d599ad03 100644 --- a/dianna/__init__.py +++ b/dianna/__init__.py @@ -26,12 +26,13 @@ logging.getLogger(__name__).addHandler(logging.NullHandler()) -__author__ = "DIANNA Team" -__email__ = "dianna-ai@esciencecenter.nl" -__version__ = "0.9.0" +__author__ = 'DIANNA Team' +__email__ = 'dianna-ai@esciencecenter.nl' +__version__ = '1.0.0' -def explain_timeseries(model_or_function, timeseries_data, method, labels, **kwargs): +def explain_timeseries(model_or_function, timeseries_data, method, labels, + **kwargs): """Explain timeseries data given a model and a chosen method. Args: @@ -46,11 +47,10 @@ def explain_timeseries(model_or_function, timeseries_data, method, labels, **kwa One heatmap per class. """ - explainer = _get_explainer(method, kwargs, modality="Timeseries") - explain_timeseries_kwargs = utils.get_kwargs_applicable_to_function(explainer.explain, kwargs) - return explainer.explain(model_or_function, - timeseries_data, - labels, + explainer = _get_explainer(method, kwargs, modality='Timeseries') + explain_timeseries_kwargs = utils.get_kwargs_applicable_to_function( + explainer.explain, kwargs) + return explainer.explain(model_or_function, timeseries_data, labels, **explain_timeseries_kwargs) @@ -69,15 +69,18 @@ def explain_image(model_or_function, input_data, method, labels, **kwargs): One heatmap (2D array) per class. """ - if method.upper() == "KERNELSHAP": + if method.upper() == 'KERNELSHAP': # To avoid Access Violation on Windows with SHAP: from onnx_tf.backend import prepare # noqa: F401 - explainer = _get_explainer(method, kwargs, modality="Image") - explain_image_kwargs = utils.get_kwargs_applicable_to_function(explainer.explain, kwargs) - return explainer.explain(model_or_function, input_data, labels, **explain_image_kwargs) + explainer = _get_explainer(method, kwargs, modality='Image') + explain_image_kwargs = utils.get_kwargs_applicable_to_function( + explainer.explain, kwargs) + return explainer.explain(model_or_function, input_data, labels, + **explain_image_kwargs) -def explain_text(model_or_function, input_text, tokenizer, method, labels, **kwargs): +def explain_text(model_or_function, input_text, tokenizer, method, labels, + **kwargs): """Explain text (input_text) given a model and a chosen method. Args: @@ -93,24 +96,28 @@ def explain_text(model_or_function, input_text, tokenizer, method, labels, **kwa List of (word, index of word in raw text, importance for target class) tuples. """ - explainer = _get_explainer(method, kwargs, modality="Text") - explain_text_kwargs = utils.get_kwargs_applicable_to_function(explainer.explain, kwargs) - return explainer.explain( - model_or_function=model_or_function, - input_text=input_text, - labels=labels, - tokenizer=tokenizer, - **explain_text_kwargs) + explainer = _get_explainer(method, kwargs, modality='Text') + explain_text_kwargs = utils.get_kwargs_applicable_to_function( + explainer.explain, kwargs) + return explainer.explain(model_or_function=model_or_function, + input_text=input_text, + labels=labels, + tokenizer=tokenizer, + **explain_text_kwargs) def _get_explainer(method, kwargs, modality): try: - method_submodule = importlib.import_module(f'dianna.methods.{method.lower()}') + method_submodule = importlib.import_module( + f'dianna.methods.{method.lower()}') except ImportError as err: - raise ValueError(f"Method {method} does not exist") from err + raise ValueError(f'Method {method} does not exist') from err try: - method_class = getattr(method_submodule, f"{method.upper()}{modality}") + method_class = getattr(method_submodule, f'{method.upper()}{modality}') except AttributeError as err: - raise ValueError(f"Data modality {modality} is not available for method {method.upper()}") from err - method_kwargs = utils.get_kwargs_applicable_to_function(method_class.__init__, kwargs) + raise ValueError( + f'Data modality {modality} is not available for method {method.upper()}' + ) from err + method_kwargs = utils.get_kwargs_applicable_to_function( + method_class.__init__, kwargs) return method_class(**method_kwargs) diff --git a/docs/conf.py b/docs/conf.py index becdbca6..8f873244 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,16 +17,16 @@ # -- Project information ----------------------------------------------------- -project = u"dianna" -copyright = u"2022, Netherlands eScience Center" -author = u"DIANNA Team" +project = u'dianna' +copyright = u'2022, Netherlands eScience Center' +author = u'DIANNA Team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = "0.9.0" +version = '1.0.0' # The full version, including alpha/beta/rc tags. release = version @@ -36,27 +36,19 @@ # extensions coming with Sphinx (named "sphinx.ext.*") or your custom # ones. extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.coverage", - "sphinx.ext.doctest", - "sphinx.ext.intersphinx", - "sphinx.ext.mathjax", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", - "autoapi.extension", - "nbsphinx", - "nbsphinx_link", - "myst_parser" + 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.napoleon', + 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'autoapi.extension', 'nbsphinx', + 'nbsphinx_link', 'myst_parser' ] # Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -70,7 +62,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_rtd_theme" +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -80,11 +72,12 @@ # -- Options for Intersphinx -intersphinx_mapping = {'python': ('https://docs.python.org/3', None), - # Commonly used libraries, uncomment when used in package - # 'numpy': ('http://docs.scipy.org/doc/numpy/', None), - # 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), - # 'scikit-learn': ('https://scikit-learn.org/stable/', None), - # 'matplotlib': ('https://matplotlib.org/stable/', None), - # 'pandas': ('http://pandas.pydata.org/docs/', None), - } +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), + # Commonly used libraries, uncomment when used in package + # 'numpy': ('http://docs.scipy.org/doc/numpy/', None), + # 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), + # 'scikit-learn': ('https://scikit-learn.org/stable/', None), + # 'matplotlib': ('https://matplotlib.org/stable/', None), + # 'pandas': ('http://pandas.pydata.org/docs/', None), +} diff --git a/setup.cfg b/setup.cfg index 9aab4c39..e6dc8b1b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,7 +25,7 @@ name = dianna project_urls = Bug Tracker = https://github.com/dianna-ai/dianna/issues url = https://github.com/dianna-ai/dianna -version = 0.9.0 +version = 1.0.0 license = Apache License 2.0 [options]