summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 06:22:35 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 06:22:35 +0000
commitd978d15d96f9f8f22b40b3e5f616214e888b8fc8 (patch)
tree2e4208eda1c300fc91aaef868bc1139a60adb066
parent12e7886c07b774af9d254e12d6710c94709c29e3 (diff)
automatic import of python-k-means-constrained
-rw-r--r--.gitignore1
-rw-r--r--python-k-means-constrained.spec279
-rw-r--r--sources1
3 files changed, 281 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..715301a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/k-means-constrained-0.7.2.tar.gz
diff --git a/python-k-means-constrained.spec b/python-k-means-constrained.spec
new file mode 100644
index 0000000..0bb2bac
--- /dev/null
+++ b/python-k-means-constrained.spec
@@ -0,0 +1,279 @@
+%global _empty_manifest_terminate_build 0
+Name: python-k-means-constrained
+Version: 0.7.2
+Release: 1
+Summary: K-Means clustering constrained with minimum and maximum cluster size
+License: BSD 3-Clause
+URL: https://github.com/joshlk/k-means-constrained
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/05/1a/452cd6c847340d09db1484aa81723c051b18fc2fbda5803514645fdc557b/k-means-constrained-0.7.2.tar.gz
+
+Requires: python3-ortools
+Requires: python3-scipy
+Requires: python3-numpy
+Requires: python3-six
+Requires: python3-joblib
+Requires: python3-wheel
+Requires: python3-setuptools
+Requires: python3-pytest
+Requires: python3-cython
+Requires: python3-pandas
+Requires: python3-twine
+Requires: python3-sphinx
+Requires: python3-sphinx-rtd-theme
+Requires: python3-numpydoc
+Requires: python3-bump2version
+Requires: python3-nose
+Requires: python3-scikit-learn
+Requires: python3-sphinx
+Requires: python3-sphinx-rtd-theme
+
+%description
+[![PyPI](https://img.shields.io/pypi/v/k-means-constrained)](https://pypi.org/project/k-means-constrained/)
+![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9-blue)
+[![Build Status](https://dev.azure.com/josh0282/k-means-constrained/_apis/build/status/joshlk.k-means-constrained?branchName=master)](https://dev.azure.com/josh0282/k-means-constrained/_build/latest?definitionId=1&branchName=master)
+[![Documentation](https://readthedocs.org/projects/pip/badge/?version=latest&style=flat)](https://joshlk.github.io/k-means-constrained/)
+
+# k-means-constrained
+K-means clustering implementation whereby a minimum and/or maximum size for each
+cluster can be specified.
+
+This K-means implementation modifies the cluster assignment step (E in EM)
+by formulating it as a Minimum Cost Flow (MCF) linear network
+optimisation problem. This is then solved using a cost-scaling
+push-relabel algorithm and uses [Google's Operations Research tools's
+`SimpleMinCostFlow`](https://developers.google.com/optimization/flow/mincostflow)
+which is a fast C++ implementation.
+
+This package is inspired by [Bradley et al.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf).
+The original Minimum Cost Flow (MCF) network proposed by Bradley et al.
+has been modified so maximum cluster sizes can also be specified along
+with minimum cluster size.
+
+The code is based on [scikit-lean's `KMeans`](https://scikit-learn.org/0.19/modules/generated/sklearn.cluster.KMeans.html)
+and implements the same [API with modifications](https://joshlk.github.io/k-means-constrained/).
+
+Ref:
+1. [Bradley, P. S., K. P. Bennett, and Ayhan Demiriz. "Constrained k-means clustering."
+ Microsoft Research, Redmond (2000): 1-8.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf)
+2. [Google's SimpleMinCostFlow C++ implementation](https://github.com/google/or-tools/blob/master/ortools/graph/min_cost_flow.h)
+
+# Installation
+You can install the k-means-constrained from PyPI:
+
+```
+pip install k-means-constrained
+```
+
+It is supported on Python 3.8 and above.
+
+# Example
+
+More details can be found in the [API documentation](https://joshlk.github.io/k-means-constrained/).
+
+```python
+>>> from k_means_constrained import KMeansConstrained
+>>> import numpy as np
+>>> X = np.array([[1, 2], [1, 4], [1, 0],
+... [4, 2], [4, 4], [4, 0]])
+>>> clf = KMeansConstrained(
+... n_clusters=2,
+... size_min=2,
+... size_max=5,
+... random_state=0
+... )
+>>> clf.fit_predict(X)
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+>>> clf.cluster_centers_
+array([[ 1., 2.],
+ [ 4., 2.]])
+>>> clf.labels_
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+```
+
+
+
+%package -n python3-k-means-constrained
+Summary: K-Means clustering constrained with minimum and maximum cluster size
+Provides: python-k-means-constrained
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-cffi
+BuildRequires: gcc
+BuildRequires: gdb
+%description -n python3-k-means-constrained
+[![PyPI](https://img.shields.io/pypi/v/k-means-constrained)](https://pypi.org/project/k-means-constrained/)
+![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9-blue)
+[![Build Status](https://dev.azure.com/josh0282/k-means-constrained/_apis/build/status/joshlk.k-means-constrained?branchName=master)](https://dev.azure.com/josh0282/k-means-constrained/_build/latest?definitionId=1&branchName=master)
+[![Documentation](https://readthedocs.org/projects/pip/badge/?version=latest&style=flat)](https://joshlk.github.io/k-means-constrained/)
+
+# k-means-constrained
+K-means clustering implementation whereby a minimum and/or maximum size for each
+cluster can be specified.
+
+This K-means implementation modifies the cluster assignment step (E in EM)
+by formulating it as a Minimum Cost Flow (MCF) linear network
+optimisation problem. This is then solved using a cost-scaling
+push-relabel algorithm and uses [Google's Operations Research tools's
+`SimpleMinCostFlow`](https://developers.google.com/optimization/flow/mincostflow)
+which is a fast C++ implementation.
+
+This package is inspired by [Bradley et al.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf).
+The original Minimum Cost Flow (MCF) network proposed by Bradley et al.
+has been modified so maximum cluster sizes can also be specified along
+with minimum cluster size.
+
+The code is based on [scikit-lean's `KMeans`](https://scikit-learn.org/0.19/modules/generated/sklearn.cluster.KMeans.html)
+and implements the same [API with modifications](https://joshlk.github.io/k-means-constrained/).
+
+Ref:
+1. [Bradley, P. S., K. P. Bennett, and Ayhan Demiriz. "Constrained k-means clustering."
+ Microsoft Research, Redmond (2000): 1-8.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf)
+2. [Google's SimpleMinCostFlow C++ implementation](https://github.com/google/or-tools/blob/master/ortools/graph/min_cost_flow.h)
+
+# Installation
+You can install the k-means-constrained from PyPI:
+
+```
+pip install k-means-constrained
+```
+
+It is supported on Python 3.8 and above.
+
+# Example
+
+More details can be found in the [API documentation](https://joshlk.github.io/k-means-constrained/).
+
+```python
+>>> from k_means_constrained import KMeansConstrained
+>>> import numpy as np
+>>> X = np.array([[1, 2], [1, 4], [1, 0],
+... [4, 2], [4, 4], [4, 0]])
+>>> clf = KMeansConstrained(
+... n_clusters=2,
+... size_min=2,
+... size_max=5,
+... random_state=0
+... )
+>>> clf.fit_predict(X)
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+>>> clf.cluster_centers_
+array([[ 1., 2.],
+ [ 4., 2.]])
+>>> clf.labels_
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+```
+
+
+
+%package help
+Summary: Development documents and examples for k-means-constrained
+Provides: python3-k-means-constrained-doc
+%description help
+[![PyPI](https://img.shields.io/pypi/v/k-means-constrained)](https://pypi.org/project/k-means-constrained/)
+![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9-blue)
+[![Build Status](https://dev.azure.com/josh0282/k-means-constrained/_apis/build/status/joshlk.k-means-constrained?branchName=master)](https://dev.azure.com/josh0282/k-means-constrained/_build/latest?definitionId=1&branchName=master)
+[![Documentation](https://readthedocs.org/projects/pip/badge/?version=latest&style=flat)](https://joshlk.github.io/k-means-constrained/)
+
+# k-means-constrained
+K-means clustering implementation whereby a minimum and/or maximum size for each
+cluster can be specified.
+
+This K-means implementation modifies the cluster assignment step (E in EM)
+by formulating it as a Minimum Cost Flow (MCF) linear network
+optimisation problem. This is then solved using a cost-scaling
+push-relabel algorithm and uses [Google's Operations Research tools's
+`SimpleMinCostFlow`](https://developers.google.com/optimization/flow/mincostflow)
+which is a fast C++ implementation.
+
+This package is inspired by [Bradley et al.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf).
+The original Minimum Cost Flow (MCF) network proposed by Bradley et al.
+has been modified so maximum cluster sizes can also be specified along
+with minimum cluster size.
+
+The code is based on [scikit-lean's `KMeans`](https://scikit-learn.org/0.19/modules/generated/sklearn.cluster.KMeans.html)
+and implements the same [API with modifications](https://joshlk.github.io/k-means-constrained/).
+
+Ref:
+1. [Bradley, P. S., K. P. Bennett, and Ayhan Demiriz. "Constrained k-means clustering."
+ Microsoft Research, Redmond (2000): 1-8.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2000-65.pdf)
+2. [Google's SimpleMinCostFlow C++ implementation](https://github.com/google/or-tools/blob/master/ortools/graph/min_cost_flow.h)
+
+# Installation
+You can install the k-means-constrained from PyPI:
+
+```
+pip install k-means-constrained
+```
+
+It is supported on Python 3.8 and above.
+
+# Example
+
+More details can be found in the [API documentation](https://joshlk.github.io/k-means-constrained/).
+
+```python
+>>> from k_means_constrained import KMeansConstrained
+>>> import numpy as np
+>>> X = np.array([[1, 2], [1, 4], [1, 0],
+... [4, 2], [4, 4], [4, 0]])
+>>> clf = KMeansConstrained(
+... n_clusters=2,
+... size_min=2,
+... size_max=5,
+... random_state=0
+... )
+>>> clf.fit_predict(X)
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+>>> clf.cluster_centers_
+array([[ 1., 2.],
+ [ 4., 2.]])
+>>> clf.labels_
+array([0, 0, 0, 1, 1, 1], dtype=int32)
+```
+
+
+
+%prep
+%autosetup -n k-means-constrained-0.7.2
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-k-means-constrained -f filelist.lst
+%dir %{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.7.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..b186dc1
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+a97bf9e7032ec8ffeed2cf6125f33d5b k-means-constrained-0.7.2.tar.gz