Spaces:
Sleeping
Sleeping
Farnaz Heidar-Zadeh commited on
Commit Β·
b3e7016
1
Parent(s): b98fe00
Rename DiverseSelector to selector
Browse files- {DiverseSelector β selector}/__init__.py +2 -2
- {DiverseSelector β selector}/_version.py +0 -0
- {DiverseSelector β selector}/converter.py +0 -0
- {DiverseSelector β selector}/distance.py +0 -0
- {DiverseSelector β selector}/diversity.py +1 -1
- {DiverseSelector β selector}/methods/__init__.py +3 -3
- {DiverseSelector β selector}/methods/base.py +0 -0
- {DiverseSelector β selector}/methods/dissimilarity.py +2 -2
- {DiverseSelector β selector}/methods/partition.py +3 -3
- {DiverseSelector β selector}/methods/similarity.py +2 -1
- {DiverseSelector β selector}/methods/tests/__init__.py +0 -0
- {DiverseSelector β selector}/methods/tests/common.py +0 -0
- {DiverseSelector β selector}/methods/tests/test_dissimilarity.py +2 -2
- {DiverseSelector β selector}/methods/tests/test_partition.py +6 -6
- {DiverseSelector β selector}/methods/utils.py +0 -0
- {DiverseSelector β selector}/tests/__init__.py +0 -0
- {DiverseSelector β selector}/tests/common.py +0 -0
- {DiverseSelector β selector}/tests/data/ref_similarity_data.csv +0 -0
- {DiverseSelector β selector}/tests/test_converter.py +1 -1
- {DiverseSelector β selector}/tests/test_distance.py +1 -1
- {DiverseSelector β selector}/tests/test_diversity.py +1 -1
- {DiverseSelector β selector}/tests/test_similarity.py +1 -1
- setup.py +18 -24
{DiverseSelector β selector}/__init__.py
RENAMED
|
@@ -21,9 +21,9 @@
|
|
| 21 |
#
|
| 22 |
# --
|
| 23 |
|
| 24 |
-
"""
|
| 25 |
|
| 26 |
-
from
|
| 27 |
|
| 28 |
|
| 29 |
# Handle versioneer
|
|
|
|
| 21 |
#
|
| 22 |
# --
|
| 23 |
|
| 24 |
+
"""Selector Package."""
|
| 25 |
|
| 26 |
+
from selector.methods import *
|
| 27 |
|
| 28 |
|
| 29 |
# Handle versioneer
|
{DiverseSelector β selector}/_version.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/converter.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/distance.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/diversity.py
RENAMED
|
@@ -27,7 +27,7 @@ import warnings
|
|
| 27 |
from typing import List
|
| 28 |
|
| 29 |
import numpy as np
|
| 30 |
-
from
|
| 31 |
|
| 32 |
|
| 33 |
__all__ = [
|
|
|
|
| 27 |
from typing import List
|
| 28 |
|
| 29 |
import numpy as np
|
| 30 |
+
from selector.distance import tanimoto
|
| 31 |
|
| 32 |
|
| 33 |
__all__ = [
|
{DiverseSelector β selector}/methods/__init__.py
RENAMED
|
@@ -21,6 +21,6 @@
|
|
| 21 |
#
|
| 22 |
# --
|
| 23 |
|
| 24 |
-
from
|
| 25 |
-
from
|
| 26 |
-
from
|
|
|
|
| 21 |
#
|
| 22 |
# --
|
| 23 |
|
| 24 |
+
from selector.methods.dissimilarity import *
|
| 25 |
+
from selector.methods.partition import *
|
| 26 |
+
from selector.methods.similarity import *
|
{DiverseSelector β selector}/methods/base.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/methods/dissimilarity.py
RENAMED
|
@@ -24,8 +24,8 @@
|
|
| 24 |
import numpy as np
|
| 25 |
from scipy import spatial
|
| 26 |
|
| 27 |
-
from
|
| 28 |
-
from
|
| 29 |
|
| 30 |
|
| 31 |
__all__ = [
|
|
|
|
| 24 |
import numpy as np
|
| 25 |
from scipy import spatial
|
| 26 |
|
| 27 |
+
from selector.methods.base import SelectionBase
|
| 28 |
+
from selector.methods.utils import optimize_radius
|
| 29 |
|
| 30 |
|
| 31 |
__all__ = [
|
{DiverseSelector β selector}/methods/partition.py
RENAMED
|
@@ -28,9 +28,9 @@ import math
|
|
| 28 |
import bitarray
|
| 29 |
import scipy.spatial
|
| 30 |
|
| 31 |
-
from
|
| 32 |
-
from
|
| 33 |
-
from
|
| 34 |
import numpy as np
|
| 35 |
from scipy import spatial
|
| 36 |
|
|
|
|
| 28 |
import bitarray
|
| 29 |
import scipy.spatial
|
| 30 |
|
| 31 |
+
from selector.methods.base import SelectionBase
|
| 32 |
+
from selector.diversity import compute_diversity, hypersphere_overlap_of_subset
|
| 33 |
+
from selector.methods.utils import optimize_radius
|
| 34 |
import numpy as np
|
| 35 |
from scipy import spatial
|
| 36 |
|
{DiverseSelector β selector}/methods/similarity.py
RENAMED
|
@@ -40,7 +40,7 @@ from math import log
|
|
| 40 |
import random
|
| 41 |
from typing import List, Optional, Union
|
| 42 |
|
| 43 |
-
from
|
| 44 |
import numpy as np
|
| 45 |
|
| 46 |
|
|
@@ -808,6 +808,7 @@ class SimilarityIndex:
|
|
| 808 |
# index they calculate. The _nw suffix indicates that the similarity index is not weighted.
|
| 809 |
# More information about the similarity indexes can be found in the following paper:
|
| 810 |
|
|
|
|
| 811 |
def _ac_nw(counters: dict) -> float:
|
| 812 |
"""Calculate the Austin-Colwell (AC) similarity index.
|
| 813 |
|
|
|
|
| 40 |
import random
|
| 41 |
from typing import List, Optional, Union
|
| 42 |
|
| 43 |
+
from selector.methods.base import SelectionBase
|
| 44 |
import numpy as np
|
| 45 |
|
| 46 |
|
|
|
|
| 808 |
# index they calculate. The _nw suffix indicates that the similarity index is not weighted.
|
| 809 |
# More information about the similarity indexes can be found in the following paper:
|
| 810 |
|
| 811 |
+
|
| 812 |
def _ac_nw(counters: dict) -> float:
|
| 813 |
"""Calculate the Austin-Colwell (AC) similarity index.
|
| 814 |
|
{DiverseSelector β selector}/methods/tests/__init__.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/methods/tests/common.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/methods/tests/test_dissimilarity.py
RENAMED
|
@@ -23,11 +23,11 @@
|
|
| 23 |
"""Test Dissimilarity-Based Selection Methods."""
|
| 24 |
|
| 25 |
|
| 26 |
-
from
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_equal
|
| 29 |
from sklearn.metrics import pairwise_distances
|
| 30 |
-
from
|
| 31 |
import pytest
|
| 32 |
|
| 33 |
|
|
|
|
| 23 |
"""Test Dissimilarity-Based Selection Methods."""
|
| 24 |
|
| 25 |
|
| 26 |
+
from selector.methods.dissimilarity import MaxMin, MaxSum, OptiSim
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_equal
|
| 29 |
from sklearn.metrics import pairwise_distances
|
| 30 |
+
from selector.methods.tests.common import generate_synthetic_data
|
| 31 |
import pytest
|
| 32 |
|
| 33 |
|
{DiverseSelector β selector}/methods/tests/test_partition.py
RENAMED
|
@@ -26,12 +26,12 @@ import numpy as np
|
|
| 26 |
from numpy.testing import assert_equal, assert_raises
|
| 27 |
import pytest
|
| 28 |
|
| 29 |
-
from
|
| 30 |
DirectedSphereExclusion,
|
| 31 |
GridPartitioning,
|
| 32 |
Medoid,
|
| 33 |
)
|
| 34 |
-
from
|
| 35 |
|
| 36 |
|
| 37 |
def test_directed_sphere_size_error():
|
|
@@ -96,11 +96,11 @@ def test_directed_sphere_on_line_with_larger_radius():
|
|
| 96 |
[0, 1],
|
| 97 |
[0, 1.1],
|
| 98 |
[0, 1.2],
|
| 99 |
-
[0, 2],
|
| 100 |
-
[0, 3],
|
| 101 |
-
[0, 3.1],
|
| 102 |
[0, 3.2],
|
| 103 |
-
[0, 4],
|
| 104 |
[0, 5],
|
| 105 |
]
|
| 106 |
)
|
|
|
|
| 26 |
from numpy.testing import assert_equal, assert_raises
|
| 27 |
import pytest
|
| 28 |
|
| 29 |
+
from selector.methods.partition import (
|
| 30 |
DirectedSphereExclusion,
|
| 31 |
GridPartitioning,
|
| 32 |
Medoid,
|
| 33 |
)
|
| 34 |
+
from selector.methods.tests.common import generate_synthetic_data
|
| 35 |
|
| 36 |
|
| 37 |
def test_directed_sphere_size_error():
|
|
|
|
| 96 |
[0, 1],
|
| 97 |
[0, 1.1],
|
| 98 |
[0, 1.2],
|
| 99 |
+
[0, 2],
|
| 100 |
+
[0, 3],
|
| 101 |
+
[0, 3.1],
|
| 102 |
[0, 3.2],
|
| 103 |
+
[0, 4],
|
| 104 |
[0, 5],
|
| 105 |
]
|
| 106 |
)
|
{DiverseSelector β selector}/methods/utils.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/tests/__init__.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/tests/common.py
RENAMED
|
File without changes
|
{DiverseSelector β selector}/tests/data/ref_similarity_data.csv
RENAMED
|
File without changes
|
{DiverseSelector β selector}/tests/test_converter.py
RENAMED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
|
| 24 |
"""Testing for Converter.py."""
|
| 25 |
|
| 26 |
-
import
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
|
| 29 |
|
|
|
|
| 23 |
|
| 24 |
"""Testing for Converter.py."""
|
| 25 |
|
| 26 |
+
import selector.converter as cv
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
|
| 29 |
|
{DiverseSelector β selector}/tests/test_distance.py
RENAMED
|
@@ -24,7 +24,7 @@
|
|
| 24 |
"""Test distance.py Module."""
|
| 25 |
|
| 26 |
|
| 27 |
-
from
|
| 28 |
pairwise_similarity_bit,
|
| 29 |
tanimoto,
|
| 30 |
modified_tanimoto,
|
|
|
|
| 24 |
"""Test distance.py Module."""
|
| 25 |
|
| 26 |
|
| 27 |
+
from selector.distance import (
|
| 28 |
pairwise_similarity_bit,
|
| 29 |
tanimoto,
|
| 30 |
modified_tanimoto,
|
{DiverseSelector β selector}/tests/test_diversity.py
RENAMED
|
@@ -26,7 +26,7 @@
|
|
| 26 |
import pytest
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises, assert_warns
|
| 29 |
-
from
|
| 30 |
compute_diversity,
|
| 31 |
gini_coefficient,
|
| 32 |
explicit_diversity_index,
|
|
|
|
| 26 |
import pytest
|
| 27 |
import numpy as np
|
| 28 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises, assert_warns
|
| 29 |
+
from selector.diversity import (
|
| 30 |
compute_diversity,
|
| 31 |
gini_coefficient,
|
| 32 |
explicit_diversity_index,
|
{DiverseSelector β selector}/tests/test_similarity.py
RENAMED
|
@@ -29,7 +29,7 @@ import numpy as np
|
|
| 29 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
|
| 30 |
import pkg_resources
|
| 31 |
import pytest
|
| 32 |
-
from
|
| 33 |
|
| 34 |
|
| 35 |
def test_SimilarityIndex_init_raises():
|
|
|
|
| 29 |
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
|
| 30 |
import pkg_resources
|
| 31 |
import pytest
|
| 32 |
+
from selector.methods.similarity import NSimilarity, SimilarityIndex
|
| 33 |
|
| 34 |
|
| 35 |
def test_SimilarityIndex_init_raises():
|
setup.py
CHANGED
|
@@ -41,7 +41,7 @@ except ValueError:
|
|
| 41 |
|
| 42 |
|
| 43 |
setup(
|
| 44 |
-
name="
|
| 45 |
author="QC-Devs Community",
|
| 46 |
author_email="qcdevs@gmail.com",
|
| 47 |
description=short_description,
|
|
@@ -50,44 +50,38 @@ setup(
|
|
| 50 |
version=versioneer.get_version(),
|
| 51 |
cmdclass=versioneer.get_cmdclass(),
|
| 52 |
license="GNU (Version 3)",
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
packages=["DiverseSelector",
|
| 56 |
-
"DiverseSelector.methods",
|
| 57 |
-
"DiverseSelector.tests",
|
| 58 |
-
"DiverseSelector.methods.tests"],
|
| 59 |
-
|
| 60 |
# Optional include package data to ship with your package
|
| 61 |
# Customize MANIFEST.in if the general case does not suit your needs
|
| 62 |
# Comment out this line to prevent the files from being packaged with your software
|
| 63 |
include_package_data=True,
|
| 64 |
-
|
| 65 |
# Allows `setup.py test` to work correctly with pytest
|
| 66 |
-
setup_requires=[
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
| 73 |
# Additional entries you may want simply uncomment the lines you want and fill in the data
|
| 74 |
url="https://github.com/theochem/DiverseSelector", # Website
|
| 75 |
-
install_requires=[
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
| 81 |
# platforms=["Linux",
|
| 82 |
# "Mac OS-X",
|
| 83 |
# "Unix",
|
| 84 |
# "Windows"],
|
| 85 |
# Python version restrictions
|
| 86 |
python_requires=">=3.7",
|
| 87 |
-
|
| 88 |
# Manual control if final package is compressible or not, set False to prevent the .egg
|
| 89 |
# from being made
|
| 90 |
# zip_safe=False,
|
| 91 |
-
|
| 92 |
# todo: add classifiers
|
| 93 |
)
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
setup(
|
| 44 |
+
name="selector",
|
| 45 |
author="QC-Devs Community",
|
| 46 |
author_email="qcdevs@gmail.com",
|
| 47 |
description=short_description,
|
|
|
|
| 50 |
version=versioneer.get_version(),
|
| 51 |
cmdclass=versioneer.get_cmdclass(),
|
| 52 |
license="GNU (Version 3)",
|
| 53 |
+
package_dir={"selector": "selector"},
|
| 54 |
+
packages=["selector", "selector.methods", "selector.tests", "selector.methods.tests"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Optional include package data to ship with your package
|
| 56 |
# Customize MANIFEST.in if the general case does not suit your needs
|
| 57 |
# Comment out this line to prevent the files from being packaged with your software
|
| 58 |
include_package_data=True,
|
|
|
|
| 59 |
# Allows `setup.py test` to work correctly with pytest
|
| 60 |
+
setup_requires=[
|
| 61 |
+
"numpy>=1.21.2",
|
| 62 |
+
"scipy==1.11.1",
|
| 63 |
+
"pytest>=6.2.4",
|
| 64 |
+
"scikit-learn",
|
| 65 |
+
"bitarray",
|
| 66 |
+
]
|
| 67 |
+
+ pytest_runner,
|
| 68 |
# Additional entries you may want simply uncomment the lines you want and fill in the data
|
| 69 |
url="https://github.com/theochem/DiverseSelector", # Website
|
| 70 |
+
install_requires=[
|
| 71 |
+
"numpy>=1.21.2",
|
| 72 |
+
"scipy==1.11.1",
|
| 73 |
+
"pytest>=6.2.4",
|
| 74 |
+
"scikit-learn",
|
| 75 |
+
"bitarray",
|
| 76 |
+
],
|
| 77 |
# platforms=["Linux",
|
| 78 |
# "Mac OS-X",
|
| 79 |
# "Unix",
|
| 80 |
# "Windows"],
|
| 81 |
# Python version restrictions
|
| 82 |
python_requires=">=3.7",
|
|
|
|
| 83 |
# Manual control if final package is compressible or not, set False to prevent the .egg
|
| 84 |
# from being made
|
| 85 |
# zip_safe=False,
|
|
|
|
| 86 |
# todo: add classifiers
|
| 87 |
)
|