Repository: dayyass/graph-based-clustering (language: python)

Issue:
add pip install



Discussion / hints:

Fix patch:
diff --git a/.coveragerc b/.coveragerc
index 08f970c..1052988 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,6 +1,6 @@
 [run]
 branch = True
-source = graph_clustering
+source = graph_based_clustering
 
 [report]
 exclude_lines =
diff --git a/.gitignore b/.gitignore
index 2278c47..fd16651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@
 venv
 .idea
 dist
+
+*.egg-info/
diff --git a/README.md b/README.md
index e108f83..c7e2b7f 100644
--- a/README.md
+++ b/README.md
@@ -27,18 +27,14 @@ pip install graph-based-clustering
 
 ### Usage
 
-**graph-based-clustering** has two clustering methods:
-- ConnectedComponentsClustering
-- SpanTreeConnectedComponentsClustering
-
-Both of these methods has sklearn-like `fit/fit_predict` interface.
+The library has sklearn-like `fit/fit_predict` interface.
 
 #### ConnectedComponentsClustering
 
-This method makes pairwise distances matrix on the input data, uses *threshold* (parameter given by the user) to binarize pairwise distances matrix and make undirected graph, and then finds connected components to perform the clustering.
+This method computes pairwise distances matrix on the input data, and using *threshold* (parameter provided by the user) to binarize pairwise distances matrix makes an undirected graph in order to find connected components to perform the clustering.
 
 Required arguments:
-- **threshold** - threshold to binarize pairwise distances matrix and make undirected graph
+- **threshold** - paremeter to binarize pairwise distances matrix and make undirected graph
 
 Optional arguments:
 - **metric** - sklearn.metrics.[pairwise_distances](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise_distances.html) parameter (default: *"euclidean"*)
@@ -47,6 +43,7 @@ Optional arguments:
 Example:
 
 ```python3
+import numpy as np
 from graph_based_clustering import ConnectedComponentsClustering
 
 X = np.array([[0, 1], [1, 0], [1, 1]])
@@ -66,7 +63,7 @@ labels_pred = clustering.fit_predict(X)
 
 #### SpanTreeConnectedComponentsClustering
 
-This method makes pairwise distances matrix on the input data, consider this matrix as a graph, finds minimum spanning trees, and finaly, to perform the clustering, makes graph with *n_clusters* (parameter given by the user) connected components by removing *n_clusters - 1* edges with highest weights.
+This method computes pairwise distances matrix on the input data, builds a graph on the obtained matrix, finds minimum spanning tree, and finaly, performs the clustering through dividing the graph into *n_clusters* (parameter given by the user) by removing *n-1* edges with the highest weights.
 
 Required arguments:
 - **n_clusters** - the number of clusters to find
@@ -78,6 +75,7 @@ Optional arguments:
 Example:
 
 ```python3
+import numpy as np
 from graph_based_clustering import SpanTreeConnectedComponentsClustering
 
 X = np.array([[0, 1], [1, 0], [1, 1]])
diff --git a/graph_clustering/__init__.py b/graph_based_clustering/__init__.py
similarity index 100%
rename from graph_clustering/__init__.py
rename to graph_based_clustering/__init__.py
diff --git a/graph_clustering/check.py b/graph_based_clustering/check.py
similarity index 100%
rename from graph_clustering/check.py
rename to graph_based_clustering/check.py
diff --git a/graph_clustering/main.py b/graph_based_clustering/main.py
similarity index 100%
rename from graph_clustering/main.py
rename to graph_based_clustering/main.py
diff --git a/graph_clustering/utils.py b/graph_based_clustering/utils.py
similarity index 100%
rename from graph_clustering/utils.py
rename to graph_based_clustering/utils.py
diff --git a/notebooks/plot_cluster_comparison.ipynb b/notebooks/plot_cluster_comparison.ipynb
index b0a6f14..2d7b210 100644
--- a/notebooks/plot_cluster_comparison.ipynb
+++ b/notebooks/plot_cluster_comparison.ipynb
@@ -55,7 +55,7 @@
     "\n",
     "import sys\n",
     "sys.path.append(\"..\")\n",
-    "from graph_clustering import ConnectedComponentsClustering, SpanTreeConnectedComponentsClustering\n",
+    "from graph_based_clustering import ConnectedComponentsClustering, SpanTreeConnectedComponentsClustering\n",
     "\n",
     "np.random.seed(0)"
    ],
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..9787c3b
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"
diff --git a/requirements.txt b/requirements.txt
index 3191c2d..cbb8dc0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,6 @@ coverage==5.5
 jupyter==1.0.0
 matplotlib==3.4.3
 numpy==1.21.2
-pandas==1.3.3
 parameterized==0.8.1
 pre-commit==2.15.0
 scikit-learn==0.24.2
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..c00615f
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,23 @@
+[metadata]
+name = graph-based-clustering
+version = 0.1.0
+author = Dani El-Ayyass
+author_email = dayyass@yandex.ru
+description = Graph-Based Clustering using connected components and spanning trees
+long_description = file: README.md
+long_description_content_type = text/markdown
+url = https://github.com/dayyass/graph-based-clustering
+project_urls =
+    Bug Tracker = https://github.com/dayyass/graph-based-clustering/issues
+classifiers =
+    Programming Language :: Python :: 3
+    License :: OSI Approved :: MIT License
+    Operating System :: OS Independent
+
+[options]
+packages = find:
+python_requires = >=3.7
+install_requires =
+    numpy >= 1.21.2
+    scikit-learn >= 0.24.2
+    scipy >= 1.7.1


Test patch:
diff --git a/tests/test_graph_clustering.py b/tests/test_graph_clustering.py
index 1bb5bcd..9b759e0 100644
--- a/tests/test_graph_clustering.py
+++ b/tests/test_graph_clustering.py
@@ -5,18 +5,21 @@
 from sklearn.metrics import rand_score
 from sklearn.preprocessing import StandardScaler
 
-from graph_clustering.check import (
+from graph_based_clustering.check import (
     _check_matrix,
     _check_matrix_is_square,
     _check_square_matrix_is_symmetric,
     check_adjacency_matrix,
     check_symmetric,
 )
-from graph_clustering.main import (
+from graph_based_clustering.main import (
     ConnectedComponentsClustering,
     SpanTreeConnectedComponentsClustering,
 )
-from graph_clustering.utils import _pairwise_distances, distances_to_adjacency_matrix
+from graph_based_clustering.utils import (
+    _pairwise_distances,
+    distances_to_adjacency_matrix,
+)
 
 from .utils import prepare_sklearn_clustering_datasets