From 150fefbf94500d716507541303eaad6fff7d9a0d Mon Sep 17 00:00:00 2001 From: Micael Verissimo de Araujo Date: Sun, 4 Oct 2020 14:16:50 -0300 Subject: [PATCH] update in order to tranform in pip like module --- bregman_clustering/__init__.py | 7 ++++ bregman_clustering/python/__init__.py | 5 +++ .../python}/cluster_algorithms.py | 5 +++ python/__init__.py | 1 - scripts/setup.sh | 6 --- setup.py | 39 +++++++++++++++++++ setup_workspace.py | 4 -- upload.sh | 3 ++ 8 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 bregman_clustering/__init__.py create mode 100644 bregman_clustering/python/__init__.py rename {python => bregman_clustering/python}/cluster_algorithms.py (98%) delete mode 100644 python/__init__.py delete mode 100644 scripts/setup.sh create mode 100644 setup.py delete mode 100644 setup_workspace.py create mode 100644 upload.sh diff --git a/bregman_clustering/__init__.py b/bregman_clustering/__init__.py new file mode 100644 index 0000000..66d40e9 --- /dev/null +++ b/bregman_clustering/__init__.py @@ -0,0 +1,7 @@ +__name__ = "bregman_clustering" + +__all__ = [] + +from . import python +__all__.extend(python.__all__) +from .python import * \ No newline at end of file diff --git a/bregman_clustering/python/__init__.py b/bregman_clustering/python/__init__.py new file mode 100644 index 0000000..67b9535 --- /dev/null +++ b/bregman_clustering/python/__init__.py @@ -0,0 +1,5 @@ +__all__ = [] + +from . import cluster_algorithms +__all__.extend( cluster_algorithms.__all__ ) +from .cluster_algorithms import * \ No newline at end of file diff --git a/python/cluster_algorithms.py b/bregman_clustering/python/cluster_algorithms.py similarity index 98% rename from python/cluster_algorithms.py rename to bregman_clustering/python/cluster_algorithms.py index ae62657..a3add28 100644 --- a/python/cluster_algorithms.py +++ b/bregman_clustering/python/cluster_algorithms.py @@ -1,3 +1,7 @@ +__all__ = [ + 'base_kmeans', +] + import numpy as np from scipy.spatial import distance import matplotlib.pyplot as plt @@ -97,6 +101,7 @@ def fit(self, X_data, breg_div='euclidean', n_iter=10, tol=1e-3, debug=False): # Jut to log the number of iteractions self.last_iter = i_iter+1 print('The conversion criteria was reached... Stopping!') + print(self.sum_total_div) break else: self.centroids = new_centers diff --git a/python/__init__.py b/python/__init__.py deleted file mode 100644 index 33fe67d..0000000 --- a/python/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from cluster_algorithms import * \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh deleted file mode 100644 index 013023b..0000000 --- a/scripts/setup.sh +++ /dev/null @@ -1,6 +0,0 @@ - -export PYTHONPATH=$PYTHONPATH:$PWD'/python' - -echo -echo "Now is everything all right" -echo \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..cf825ef --- /dev/null +++ b/setup.py @@ -0,0 +1,39 @@ +# Imports +from setuptools import setup, find_packages + +# Loading README file +with open("README.md", "r") as fh: + long_description = fh.read() + +setup( + name = 'bregmanclustering', + version = '0.3', + license='GPL-3.0', + description = 'A framework to use Bregman Divergence', + long_description = long_description, + long_description_content_type="text/markdown", + packages=find_packages(), + author = 'Micael Veríssimo de Araújo', + author_email = 'micael.verissimo@lps.ufrj.br', + url = 'https://github.com/micaelverissimo/bregmannclustering', + keywords = ['framework', 'information-geometry', 'machine-learning', 'ai', 'plotting', 'data-visualization'], + install_requires = [ + 'numpy', + 'six>=1.12.0', + 'scipy==1.4.1', + 'future', + 'sklearn', + 'scikit-learn>=0.22.1', + 'matplotlib>=3.1.3', + 'seaborn>=0.10.0', + ], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + ], +) \ No newline at end of file diff --git a/setup_workspace.py b/setup_workspace.py deleted file mode 100644 index f9c7786..0000000 --- a/setup_workspace.py +++ /dev/null @@ -1,4 +0,0 @@ -import os - -os.makedirs('./data_files/') -os.makedirs('./clustering_plots/') diff --git a/upload.sh b/upload.sh new file mode 100644 index 0000000..de7d21d --- /dev/null +++ b/upload.sh @@ -0,0 +1,3 @@ +rm dist/* +python3 setup.py sdist +twine upload dist/* \ No newline at end of file