-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🎨 move to src layout * 🔥 moved to pyproject.toml (from setup.py) * 🎨🔖 switch to dynamic versioning based on tags - each commit gets his own version relativ to the last tag - releases do not require manuel setting of version (they pick it up from the git tags) * 🐛 set src pkg path correctly for readthedocs * 🐛 forgot to activate scm via setting an entry in pyproject.toml see https://setuptools-scm.readthedocs.io
- Loading branch information
Showing
36 changed files
with
89 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
authors = [{ name = "Alberto Santos Delgado", email = "[email protected]" }, | ||
{ name = "Henry Webel", email = "[email protected]"}] | ||
name = "acore" | ||
version = "0.1.2" | ||
dynamic = ["version"] | ||
description = "A Python package with statistical functions to analyse multimodal molecular data" | ||
license = { text = "GNU General Public License v3" } | ||
readme = "README.rst" | ||
|
@@ -68,9 +68,11 @@ Documentation = "https://analytics-core.readthedocs.io/" | |
|
||
|
||
[build-system] | ||
requires = ["setuptools"] | ||
requires = ["setuptools>=64", "setuptools_scm>=8"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
|
||
# [entrypoints] | ||
# console_scripts = { | ||
# "acore = acore.cli:main" | ||
|
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,18 +1,3 @@ | ||
#!/usr/bin/env python | ||
from setuptools import setup | ||
|
||
"""The setup script.""" | ||
|
||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
entry_points={ | ||
'console_scripts': [ | ||
'acore=acore.cli:main', | ||
], | ||
}, | ||
include_package_data=True, | ||
keywords='acore', | ||
packages=find_packages(include=['acore', 'acore.*']), | ||
url='https://github.com/Multiomics-Analytics-Group/acore', | ||
zip_safe=False, | ||
) | ||
setup() |
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.
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.
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""Plot metrics for binary classification.""" | ||
|
||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
from njab.sklearn.types import Results, ResultsSplit | ||
|
||
LIMITS = (-0.05, 1.05) | ||
|
||
|
||
def plot_split_auc( | ||
result: ResultsSplit, name: str, ax: matplotlib.axes.Axes | ||
) -> matplotlib.axes.Axes: | ||
"""Add receiver operation curve to ax of a split of the data.""" | ||
col_name = f"{name} (auc: {result.auc:.3f})" | ||
roc = pd.DataFrame(result.roc, index="fpr tpr cutoffs".split()).rename( | ||
{"tpr": col_name} | ||
) | ||
ax = roc.T.plot( | ||
"fpr", | ||
col_name, | ||
xlabel="false positive rate", | ||
ylabel="true positive rate", | ||
style=".-", | ||
ylim=LIMITS, | ||
xlim=LIMITS, | ||
ax=ax, | ||
) | ||
return ax | ||
|
||
|
||
# ! should be roc | ||
def plot_auc( | ||
results: Results, | ||
ax: matplotlib.axes.Axes = None, | ||
label_train="train", | ||
label_test="test", | ||
**kwargs, | ||
) -> matplotlib.axes.Axes: | ||
"""Plot ROC curve for train and test data.""" | ||
if ax is None: | ||
fig, ax = plt.subplots(1, 1, **kwargs) | ||
ax = plot_split_auc(results.train, f"{label_train}", ax) | ||
ax = plot_split_auc(results.test, f"{label_test}", ax) | ||
return ax | ||
|
||
|
||
def plot_split_prc( | ||
result: ResultsSplit, name: str, ax: matplotlib.axes.Axes | ||
) -> matplotlib.axes.Axes: | ||
"""Add precision recall curve to ax of a split of the data.""" | ||
col_name = f"{name} (aps: {result.aps:.3f})" | ||
roc = pd.DataFrame(result.prc, index="precision recall cutoffs".split()).rename( | ||
{"precision": col_name} | ||
) | ||
ax = roc.T.plot( | ||
"recall", | ||
col_name, | ||
xlabel="true positive rate", | ||
ylabel="precision", | ||
style=".-", | ||
ylim=LIMITS, | ||
xlim=LIMITS, | ||
ax=ax, | ||
) | ||
return ax | ||
|
||
|
||
def plot_prc( | ||
results: ResultsSplit, | ||
ax: matplotlib.axes.Axes = None, | ||
label_train="train", | ||
label_test="test", | ||
**kwargs, | ||
): | ||
"""Plot precision recall curve for train and test data.""" | ||
if ax is None: | ||
fig, ax = plt.subplots(1, 1, **kwargs) | ||
ax = plot_split_prc(results.train, f"{label_train}", ax) | ||
ax = plot_split_prc(results.test, f"{label_test}", ax) | ||
return ax |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.