From 7995684f48254fe27823875d5916af14ba96c515 Mon Sep 17 00:00:00 2001 From: qzhao19 Date: Sat, 22 Jul 2023 22:59:29 +0800 Subject: [PATCH] update --- example.py | 18 ++++++++++++++++++ setup.py | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 example.py create mode 100644 setup.py diff --git a/example.py b/example.py new file mode 100644 index 0000000..5210e29 --- /dev/null +++ b/example.py @@ -0,0 +1,18 @@ +import numpy as np +from kdtree import KDTree +from sklearn import datasets + +def test(data): + num_samples, _ = data.shape + + ratio = 0.85 + X_train = data[:int(ratio*num_samples), :] + X_test = data[int(ratio*num_samples):, :] + + kd_tree = KDTree(X_train) + kd_tree.build_tree() + + nn = kd_tree.query(X_test, 4) + +if __name__ == "__main__": + test(datasets) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2176d99 --- /dev/null +++ b/setup.py @@ -0,0 +1,24 @@ +import os +import sys +from setuptools import setup + +setup(name ="kdtree", + version = "1.0.0", + description = "Python library for optimization descent algorithms", + long_description = open("README.md").read(), + url = "https://github.com/qzhao19/kdtree", + author = 'Qi ZHAO', + author_email = 'qi.zhao@outlook.fr', + license = "MIT", + packages = ['kdtree'], + install_requires = ["numpy>=1.19.5"], + classifiers=[ + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Mathematics :: Machine Learning Algorithms", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + 'Operating System :: Unix', + ], + keywords='kdtree', +) \ No newline at end of file